How to Pass parameter to SQlDataSource from gridview?

Up vote 0 down vote favorite share g+ share fb share tw.

Gridview has many columns and a Delete button as well. Delete button is a control as TemplateField ' OnClientClick="return confirm('Are you sure you want to take this action? ');" runat="server"> Now associated SQLDataSource's Delete command's stored procedure is expecting two parameters.

One is going from DataKeyNames (RowID), other one I wanna pass is the Text of btnDelete (True or False). How can I achieve it? C# asp.net gridview sqldatasource link|improve this question asked Apr 7 '10 at 15:50Jango6121826 70% accept rate.

I would recommend doing it in the code behind. On btnDelete click I would iterate through every row in your gridview and check all the datakeynames. Once I found the one you want to delete you will need to send that back to you db.

You can use either an orm like linq, ado.net, or a straight sqlcmd.

Please See this Code. I implement and works fine ' /> " SelectCommand="select* from MassTraxCatProjects where Fk_AgencyId=@CatalogAgencyId and fk_trackid=@TrackID).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions