A Strange Problem in Asp.Net FormView control RRS feed

  • Question

  • We have a FormView control to show customer information with paging enabled in an .aspx page named Customer.aspx. We can navigate page by page to show customer information per page. FormView datasource has been a SqlDataSource control which is calling a stored Procedure. And FormView dataKey has been set to be customerID.


    Now in this page FormView nevigation is working well showing customer page by page order by their names.


    We have another page named Sales.aspx, from which we can get back to our previous page named Customer.aspx by clicking a button. At this time we are taking a particular customerID in Session and calculation the rowid/position of this customer [with an order by query which is the same with the stored procedure of FormView Datasource]. Now we are doing

                                        FormView1.PageIndex = CustomerPosition;


    So that we can directly go to the FormView page where this customer is and as FormView datakey is the customerID we can view this particular customer data in that FormView page.


    Instead of this we are having a wrong customer data in that page of FormView. What is more interesting here that not every time this is happening……sometimes it is working fine showing correct customer information in FormView pages and ‘Next’,’Previous’ working fine with correct results. Here by correct customer I mean that particular customer which belongs to that FormView page. We have checked our log file. There we have found out that after FormView pageindex has been changed, sometimes (randomly) FormView.selectedvalue is wrongly referring to a different CustomerID which was not the correct one.


    The whole behavior is completely random and does not have a recognizable pattern. Sometimes (randomly) FormView.selectedvalue is choosing a wrong value and it’s a read only field. While running it at our local boxes, the frequency of error is less whereas frequency of error is more when we are running it at our server. We are using windows server 2003, Sql server 2005 and IIS6 and ASP.NET 3.0


    Any suggestions will be greatly appreciated. Thanks.

    Wednesday, January 14, 2009 9:50 AM

All replies

  •  Step through the code in debug and you will likely find an unexpected intermittent loop related to current record.
    Sunday, March 1, 2009 9:51 PM