我怎样才能获得数据绑定的发送者? [英] How can I get sender of databinding?

查看:89
本文介绍了我怎样才能获得数据绑定的发送者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

我在网站上使用c#。

在设计部分我将数据绑定到属性

Hello.
I use c# for website.
In design part I you databinding to property

<asp:Button ID="T1801" CssClass="costlinks" OnClick="costlinks_Click" runat="server" Text='<%#  FF_1  %>' />



如何我可以在属性请求中获取按钮的ID


How could I get the ID of button in property request

protected string FF_1
		{
			get { return "I want sender ID here"; }
		}



谢谢。


Thank you.

推荐答案

<asp:Button ID="T1801" CssClass="costlinks" runat="server" Text='<%#  T1801.ClientID  %>' />











or

<asp:Button ID="T1801" CssClass="costlinks" runat="server" Text='<%# string.Format("The Client ID is {0}",  T1801.ClientID)  %>' />





或者如果您仍想使用代码-behind





or if you still want to use code-behind

<asp:Button ID="T1801" CssClass="costlinks" runat="server" Text='<%# FF_1(T1801)  %>' />







protected string FF_1(Button button)
{
    return button.ClientID;
}


这篇关于我怎样才能获得数据绑定的发送者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆