Page_load evet fires twice after migrated the application from VS 2003 to VS 2008

Swapnam

New member
Joined
Jul 23, 2009
Messages
2
Hi All,

I am facing issues after migrating our application from VS 2003 to VS 2008. We use Asp.net and C#(as code behind).

Therea are 2 dropdowns in the page. On change of values of these dropdowns we need to grop the data accordingly and display in a datagrid. By default the data will be sorted on the column that is selected in the dropdown.

After the data is displayed, if user clicks on some other column in the datagrid header, data should be sorted on the column clicked by the user. But after migration to VS 2008, when user is clicking on some other column in the datagrid, application is not changing the sorting column.

Example: I select "Age" in the dropdown. So, data is grouped by "Age" and will be displayed by sorting the data on "Age". Now if I click on "Name" column in the datagrid header, then data displayed should be "grouped by Age and sorted by Name". But after migration, applicaiton is displaying data "grouped by Age and reverse sorted by Age".

While debugging I found that it is being caused since page_load event is fired twice in this case. When page load is fired for the first time it is loading the page as expected. But when fired for the second time all the parameters are reset and thus causing the issue.

Can anybody let me know what could have caused this issue? Please help me in solving this issue.

Thanks in advance.
 
This can happen if you have the option to auto wire up events set in the @Page directive and if you are also manually attaching the event handler in code.
 
Back
Top