I've written an event handler to handle the RowDataBound event in datagrid creation, basically the event handler just adds some attributes to the row. I know it works as when I set the OnRowDataBound event in the HTML properties it works as expected.
However, I have changed the page so that I am no longer setting up the datagrid in the HTML, I am now creating the datagrid in the codebehind. So now, I am trying to call the event handler from the c# code in the codebehind. Please keep in mind that I am
pretty new to c# so if I am missing something obvious, please forgive me. I have this so far in the code:
GridViewName.RowDataBound += EventHandlerName( );
Which obviously doesn't work as I need to pass the object and the event arguments to the event handler, but right now, I have no idea how to do it. If anyone can provide me with specific instructions on how to accomplish this I would be greatly appreciative.
madrak
Member
94 Points
35 Posts
onRowDataBound vs RowDataBound
May 26, 2006 08:12 PM|LINK
However, I have changed the page so that I am no longer setting up the datagrid in the HTML, I am now creating the datagrid in the codebehind. So now, I am trying to call the event handler from the c# code in the codebehind. Please keep in mind that I am pretty new to c# so if I am missing something obvious, please forgive me. I have this so far in the code:
GridViewName.RowDataBound += EventHandlerName( );
Which obviously doesn't work as I need to pass the object and the event arguments to the event handler, but right now, I have no idea how to do it. If anyone can provide me with specific instructions on how to accomplish this I would be greatly appreciative.
-Madrak