0

can we pass multiple eval field in one command argument.

my code is here

<asp:TemplateField HeaderText="Details" SortExpression="source"> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("source") %>' CommandName="Download" Text='<%#Eval("source") %>'></asp:LinkButton> </ItemTemplate> </asp:TemplateField>

I want to be pass many Eval field in single command argument with command name if possible please show any reference.

KKDev
  • 141
  • 1
  • 3
  • 17
  • 1
    Share code in text format not as image, It will be more helpful. Webruster and Imad solution will work for you :) – Suprabhat Biswal Oct 29 '15 at 05:34
  • @kkZone my solution wil solve your need , i am passing many eval field with comma seperated and using the `command name` i am able to slit them at code behind – Krsna Kishore Oct 29 '15 at 05:42

2 Answers2

7

If this is what you are asking as you didnt provide any code snippet i'm assuming like this

CommandArgument='<%#Eval("ScrapId")+","+ Eval("UserId")%>'

In code behind you can use retrieve values like this

protected void GridViews_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "Comment")
    {
        string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
        string scrapid = commandArgs[0];
        string uid = commandArgs[1];
    }
}
Krsna Kishore
  • 8,233
  • 4
  • 32
  • 48
0

You can do something like

<%# Eval("Param1").ToString() + Eval("Param2").ToString() %>

Imad
  • 7,126
  • 12
  • 55
  • 112