Passing more than one argument in asp.net button in gridview

Posted by MarceloRamires on Stack Overflow See other posts from Stack Overflow or by MarceloRamires
Published on 2010-04-05T12:32:17Z Indexed on 2010/04/05 12:43 UTC
Read the original article Hit count: 319

Filed under:
|
|
|
|

I have a TemplateField column in a gridview with a button inside of it.

There is NO key value (surely that was not designed by me) , but in the other hand there aren't redundancies when comparing each single column, because they are events, and there is "starting date" and "ending date" of something that could not happen twice at the same time.

I've already figured selecting with these values and all, but I just want the button to pass about five arguments to a given function.

I've tested:

<asp:Button  CommandArgument='<%# Eval("day")%>'  ID="Button2" runat="server" Text="Button" />

And it works properly, the day of the clicked row is passed, and could be retrieved through:

e.CommandArgument.ToString();

in the GridView_RowCommand handler.

How do I pass more than one argument? I've thought about concatenating with a separating character (wouldn't be that bad) but besides not knowing how to do it yet (didn't want to invest in a poor solution) I want a smarter one.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about templatefield