I have a GridView that I put inside an update panel.
I have a control that attaches to the datasource of the gridview that filters the data, databinds the gridview and then updates the update panel that the gridview is in.
In my page render I put this so I could select a row by just clicking it.
Expand|Select|Wrap|Line Numbers
- protected override void Render(HtmlTextWriter writer)
- {
- foreach (GridViewRow row in GridView1.Rows)
- {
- if (row.RowType == DataControlRowType.DataRow)
- {
- row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(GridView1, "Select$" + row.RowIndex.ToString(), true));
- }
- }
- Page.ClientScript.RegisterForEventValidation(GridView1.UniqueID);
- base.Render(writer);
- }
First hit of page
Expand|Select|Wrap|Line Numbers
- <tr onMouseOver="this.style.cursor='hand'; this.style.background='yellow';" onMouseOut="this.style.background='#FFFFFF';" onclick="__doPostBack('ctl00$ContentPlaceHolder1$CustomControl1$GridView1','Select$0')" style="color:#333333;background-color:White;"><td>mydata</td></tr>
Expand|Select|Wrap|Line Numbers
- <tr onMouseOver="this.style.cursor='hand'; this.style.background='yellow';" onMouseOut="this.style.background='#FFFFFF';" style="color:#333333;background-color:White;"><td>mydata</td></tr>