Dear Readers,
Here is the code that helps you to pass more then one parameters in asp button
ASPX or ASCX code
<asp:GridView ID="GridViewUserScraps" ItemStyle-VerticalAlign="Top" AutoGenerateColumns="False" Width="100%" runat="server" OnRowCommand="GridViews_RowCommand" >
<Columns>
<asp:TemplateField SortExpression="SendDate">
<ItemTemplate>
<asp:Button ID="btnPost" CssClass="submitButton" Text="Comment" runat="server" CommandName="Comment" CommandArgument='<%#Eval("ScrapId")+","+ Eval("UserId")%>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code Behind Function
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];
}
}
Regards
Rashid Imran Bilgrami
http://www.bestvisualization.com
Comments
Post a Comment
Thanks for the Comments , Your review will display soon