ASP.NET 1.1 to ASP.NET 2.0 Migration #10
This time, I will be sharing a tip on DataGrid which is migrated from ASP.NET 1.1 to ASP.NET 2.0. Actually when you migrate the datagrid into .net 2.0 environment, you will be surprised to find that there are no events for that datagrid in the Properties Windows, but there are events at the code behind. It is a common problem here. So don’t get surprised.
See this:
http://community.sgdotnet.org/photos/chuawenching/picture53752.aspx
To solve this problem, all you need to code the events manually as below:
The reason is you can still live on with that. Just if you are a new developer for the project, you will be confused on this one and have questions in mind like “If there is no events in the Properties Window, I assume the events at the code behind are useless, maybe the previous developer did not clean up his messy code?”
// Add the code in bold
<asp:DataGrid id="dtgAssoc" Width="100%" AllowPaging="True" CssClass="dgStyle" BorderColor="Navy" runat="server" AutoGenerateColumns="False" AllowSorting="True"
OnPageIndexChanged="dtgAssoc_PageIndexChanged" >
<AlternatingItemStyle CssClass="dgAlternatingItem"></AlternatingItemStyle>
<HeaderStyle CssClass="dgHeader"></HeaderStyle>
So by doing this, the event will appear in the Properties Window. Give it a try yeah :P