I am new to creating ASP.Net pages. I have a basic asp.net page with a GridView object, and I have written a RowDataBound Event to change the row colors based on a condition. I need some help on how to link my function/event to the acutal GridView object. Should the function/event be placed on the client side or server-side?
ps. Im using Visual Studio 2010, if there is a way to add functions to an object using the toolbar options that would be awesome.
RowDataBound event is handled on the server side. You can either have the event code/logic in the “code-behind” file, or you can add an inline script in your HTML file.
It is important to note that the OnRowDataBound property must have the same name as your even method. For example
OnRowDataBound="GridView1_RowDataBound"has the same name as the event handler signatureGridView1_RowDataBound(object sender, GridViewRowEventArgs e).For more info, see here.