views:

304

answers:

0

Hello,

I have a problem using the asp:ListView component. I have a search page, where the user can search on different fields in the database. When clicking the search button I do a search in the database and binds the result to a ListView inside the click button event. The reason why I want to use a ListView for this task is that each result row shall be selectable. When a row is selected, detailed information about this row shall be expanded. This is done using the selecteditemtemplate.

The problem is that when populating the dataset from codebehind in the on click event it somehow causes the select button to not respond the first time I click on it. It expands the second time I click on the row's button. For instance, if I click on the second row, nothing happens more than a postback. Then if I click on the third row, the second row gets expanded. So it is one click behind all the time. I saw that there were similar problem with the pager component and the listview. The solution to that issue was to do databind on the Page_PreRender event. But this is not a solution for me.

Am I missing out some trivial workflow here?

Best Regards, Tobias