Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gridview Issue with Selecting Row for SQL Stored Procedure

Status
Not open for further replies.

oldmanbernie

Programmer
Jan 18, 2007
9
0
0
US
On every row of a gridview, I want to add a button that will invoke a SQL Stored Procedure. One of the parameters I need for the stored procedure is on one of the columns of the gridview based on the corresponding row. How do I go about adding that parameter in the following form:

SqlCmd.Parameters.Add(new SqlParameter("@foo", ???);
 
Create a button in the GridView, add a commandargument to it (with the value set to the same as the value you need to pass) and then use the ItemCommand event to fire off your stored procedure (the value will be in e.CommandArgument).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top