Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Render method not applying for gridview in update panel on a user control

$
0
0
I have a user control with a grid view that I wish the user to be able to click the row and cause the selectedIndexChanged event to fire on the grid view. To do this I have overridden the Render method on the user control to do the following:

protected

overridevoid Render(System.Web.UI.HtmlTextWriter writer)
{
   if (GridView1.Rows.Count > 0)
   {
      foreach (GridViewRow rowin GridView1.Rows)
      {
         if (row.RowType ==DataControlRowType.DataRow)
         {
            row.Attributes[
"onclick"] = Page.ClientScript.GetPostBackEventReference(this.GridView1,"Select$"+ row.RowIndex,true);
            row.Style[
"cursor"] ="hand";
         }
      }
   }
base.Render(writer);
}

However, If I put a update panel around my grid, this no longer works (the style and onclick attribute are no longer available). The exact same code placed directly on a page will work correctly. I have spent hours looking into this and as I cannot find anything, I can only assume that I am missing something fundamental. I can post a full example if it will help. Cheers

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>