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

Enable edit buttons with select cmd from code-behind

P: n/a
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

Nov 28 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.