469,954 Members | 1,891 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

Help with GridView/FormView databound to same SQLDataSource

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
0 1924

Post your reply

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

Similar topics

reply views Thread by Swetha | last post: by
4 posts views Thread by Alexander Widera | last post: by
4 posts views Thread by P. Yanzick | last post: by
1 post views Thread by Andre | last post: by
3 posts views Thread by Bas Paap | last post: by
5 posts views Thread by =?Utf-8?B?QWRhciBXZXNsZXk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.