By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 3,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

Help with GridView/FormView databound to same SQLDataSource

P: 1
G'day all.

I having a problem with my formview. I'll ty to explain my situation as best as i can.

I have a page with a search field at the top which is just a simple asp:textbox. Below that i have a gridview which displays the results of the search. if no search is entered, then the gridview shows all records. Below the gridview i have a formview for inserting and editing the records. when a user clicks on one of the records in the gridview, it will change the formview to edit mode and populate it with the record's details. This gridview/formview link is done by setting the formview.pageIndex = gridview.selectedIndex.

The way this works is as follows. I have the gridview bound to a sqldatasource (name = ProcIO). I also have the formview bound to the same sqldatasource. When the page loads, the gridview displays all records, and the user can click one to edit in the formview. This works fine. However, when the user inputs a search value, the gridview rebinds and display the records the user searched for, yet the formview will not rebind. The formview does not display the record the user clicked on the gridview, but the formview does display a record which was in the same index location when the gridview loaded all the records. This leads me to believe the gridview is rebinding, yet the formview is not.

The way i display the search results in the gridview is by changing the sqldatasource's (ProcIO) selectcommand to add in the sql WHERE clause to include the search value. This alone will cause the gridview to rebind/update with the search results, without calling the gridview.databind().

I have tried calling the formview.databind(), but with no luck. I am absolutely stuck on how to make the formview rebind to the sqldatasource with the new selectcommand.

I can post my source & code if it will help.

Thanks in advance.

Liam.
Mar 16 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.