DEV Community

Tummala Krishna Kishore
Tummala Krishna Kishore

Posted on • Updated on

Pass multiple Eval field in one command argument in Repeater Control

This is the most common problem that generally users face while dealing with Repeater control. I gave this solution in Stackoverflow. want to post it here for users coming from search

Add the below snippet in in template

CommandArgument='<%#Eval("ScrapId")+","+ Eval("UserId")%>'
Enter fullscreen mode Exit fullscreen mode

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];
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)