0

I have a big table that I need to develop it as a part of an ASP.NET web application. The data will be retrieved from the database. instead of viewing the data directly. I want through the C# to determine each cell in GridView and determine the what it will be displayed. Also, for editing and inserting the data, to do that programmatically (code-behind) since I am using a storedprocedure. I am thinking to do the insertion and editing for this gridview by using the checkbox.

Could you please provide me with the useful resources to do this?

user730077
  • 199
  • 1
  • 13

3 Answers3

2

You will have to use the RowDataBound event of the GridView, which accesses each row of the datasource before actually binding it to the gridview.

    void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
  {
    if(e.Row.RowType == DataControlRowType.DataRow)
    {
      //Have Your Logic Here
      //Example : Cell 0 will be italics
      e.Row.Cells[0].Text = "<i>" + e.Row.Cells[0].Text + "</i>";
    }
  }

Hope this helps you.

Adi
  • 61
  • 6
0

Implement RowDataBound event for your data grid and then implement logic here to check the cells of the particular row.

Huske
  • 9,186
  • 2
  • 36
  • 53
0

Please see code here for editing GridView programmatically:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowediting.aspx

Elias Hossain
  • 4,410
  • 1
  • 19
  • 33