如何在BehindCode C#中获取CommandArgument [英] How To Get CommandArgument in BehindCode C#
本文介绍了如何在BehindCode C#中获取CommandArgument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
hi all
<asp:ImageButton ID="BtnThanks" runat="server" ImageUrl="../Image/Thanks.png" ToolTip="Thanks"
OnClick="BtnThanks_Click" CommandArgument=<%# Eval("Question_Icon") %> />
protected void BtnThanks_Click(object sender, EventArgs e)
{
//How To Get CommandArgument????
}
非常感谢
Thanks so Much
推荐答案
下面的详细示例:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandargument.aspx [
detailed example below:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandargument.aspx[^]
尝试:
ImageButton myButton = sender as ImageButton ;
if (myButton != null)
{
string title = myButton.CommandArgument;
// use this title now to set as a text for your label.
// Use below for rowIndex
}
这篇关于如何在BehindCode C#中获取CommandArgument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文