Enable edit buttons with select cmd from code-behind

J

jmacduff

Big question: How to enable edit/update commands to work when setting
the sqldatasource select command from code behind.

Details:

I have a GridView using a sqldatasouce with the select and update
commands set. The gridview is part of a "admin" page where the admin
will view the data, then use the gridview edit/update buttons to update
the data.......that all works great.

However now we want to add a "search" function since the dataset is
pretty big.... so in the codebehind I do this:

//update the select command with a search syntax
this.MusicNamesqlSource.SelectCommand = "EXEC foo.foo_SearchDB " + "'"
+ this.foodbAccess.SafeSqlLiteral(szSearchTerm) + "'";

//rebind the gridview so the select command fires
this.MusicNamesGridView.DataBind();

So that works.. it does display the altered results.. however THEN the
edit buttons dont work! The update command hasnt changed.. but when the
user clicks "update" the update command doesnt work... it doesnt break
or anything.. it simply doesnt work :(

-Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,270
Latest member
TopCryptoTwitterChannels_

Latest Threads

Top