views:

387

answers:

2

I have a gridview with multiple rows, each has a Update button and I need to pass 2 values when someone clicks on Update button. Aside from packing the arguments inside CommandArgument separated by commas (archaic and not elegant), how would I pass more than one argument?

<asp:LinkButton ID="UpdateButton" runat="server" CommandName="UpdateRow" CommandArgument="arg_value" Text="Update and Insert" OnCommand="CommandButton_Click" ></asp:LinkButton>

As a note, the values can't be retrieved from any controls on the page, so don't offer any design solutions. Please concentrate on the question asked. Thanks in advance.

+1  A: 

Hey,

Either store it in the gridview datakeys collection, or store it in a hidden field inside the same cell, or join the values together. That is the only way. You can't store two values in one link.

Brian
+2  A: 

After poking around it looks like Kelsey is correct.

Just use a comma or something and .split( after you consume it.

cazlab
found this:http://aspdotnetcodebook.blogspot.com/2008/09/how-to-pass-multiple-values-to.html
gnomixa