Hello-World
Hello-World

Reputation: 9555

debug a gridview object like you can with a datatable

Is it possible to debug a gridview object like you can with a datatable. By this I mean adding a watch to the object then see the data visually?

Thnaks for the help.

Upvotes: 0

Views: 1223

Answers (1)

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28970

Yes you can debug your GridView, you use RowDataBound Event

  <asp:gridview id="GridView1" 
    datasourceid="...." 
    autogeneratecolumns="true"
    onrowdatabound="GridView1_RowDataBound" 
    runat="server">
  </asp:gridview>


void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
  {

    if(e.Row.RowType == DataControlRowType.DataRow)
    {
        Console.Write(e.Row.Cells[1].Text);
        .....
    }

  }

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

Upvotes: 1

Related Questions