Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:15:12+00:00 2026-05-27T04:15:12+00:00

I am new in ASP.NET ,I would have editable gridview in asp.net using C#

  • 0

I am new in ASP.NET ,I would have editable gridview in asp.net using C# , I found this editable gridview (Database , Project) in codeproject but i didn’t realize how
its work specially this part of code:`

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
     DataRowView drv = e.Row.DataItem as DataRowView;
       if (e.Row.RowType == DataControlRowType.DataRow)
      {
          if ((e.Row.RowState & DataControlRowState.Edit) > 0)
          {
              DropDownList dp= (DropDownList )e.Row .FindControl ("DropDownList1");
              DataTable dt = load_department();
              for (int i = 0; i < dt.Rows.Count; i++)
           {
               ListItem lt = new ListItem();
               lt.Text = dt.Rows[i][0].ToString();
               dp.Items.Add(lt);
           }
              dp.SelectedValue = drv[3].ToString();
              RadioButtonList rbtnl = (RadioButtonList)e.Row.FindControl("RadioButtonList1");
              rbtnl.SelectedValue = drv[5].ToString();
              CheckBoxList chkb = (CheckBoxList)e.Row.FindControl("CheckBoxList2");
              chkb.SelectedValue = drv[6].ToString();    
          }              
       }
   }

`
Why she/he do this??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:15:13+00:00Added an answer on May 27, 2026 at 4:15 am

    RowDataBound event fires when you bind the grid to a datasource, say, for example, a datatable.

    For each row in the datatable, this code will run, and will, depending on the values in that row, put a value in each column of the grid view.

    FindControl is used to find the control with the spcific name on that line of the grid view – remember, it will be repeated many times for as many rows as you have.

    Once the control has been found, the value is set.

    You are effectively setting up each row of the grid view for each row of the data in your data source.

    Take a look at http://msdn.microsoft.com/en-us/magazine/cc163933.aspx for an overview of the intent behind this control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using GIT with a new ASP.NET MVC project. I have a line
I am researching a new ASP.Net project that we would like to host in
I am trying to start a new project (asp.net MVC) and I would like
I am new to programming. Using C# & ASP.Net, how would I differentiate between
I'm using the new ASP.Net ListView control to list database items that will be
I am fairly new to asp.net, and have little experience with iis. I would
We are starting a new ASP.NET MVC project and we would like to establish
I have just set up a new ASP.NET MVC website and I would like
I am using NHibernate on a new ASP.NET project, and am running into what
We have a new ASP.NET project on VS 2008 environment, and a new TFS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.