Pass multiple Eval field in one command argument in Repeater Control

webrusterkk

Tummala Krishna Kishore

Posted on July 1, 2021

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
💖 💪 🙅 🚩
webrusterkk
Tummala Krishna Kishore

Posted on July 1, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related