Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Set programmaticaly从代码隐藏调用函数的文本属性_C#_Asp.net - Fatal编程技术网

C# Set programmaticaly从代码隐藏调用函数的文本属性

C# Set programmaticaly从代码隐藏调用函数的文本属性,c#,asp.net,C#,Asp.net,我想从“代码隐藏”中的函数初始化按钮的标签: <asp:Button ID="BtnAjoutClient" runat="server" Text='<%= GetText()%>' /> 但是按钮的标题显示了原始代码(并且该函数从未被调用)。我也尝试了。你知道为什么吗 关于您不能像在服务器端控件中那样使用服务器端代码块 使用代码隐藏文件: BtnAjoutClient.Text = GetText(); 不能像在服务器端控件中那样使用服务器端代码块 使用代码隐藏文

我想从“代码隐藏”中的函数初始化按钮的标签:

<asp:Button ID="BtnAjoutClient" runat="server" Text='<%= GetText()%>' />
但是按钮的标题显示了原始代码(并且该函数从未被调用)。我也尝试了
。你知道为什么吗

关于您不能像在服务器端控件中那样使用
服务器端代码块

使用代码隐藏文件:

BtnAjoutClient.Text = GetText();
不能像在服务器端控件中那样使用
服务器端代码块

使用代码隐藏文件:

BtnAjoutClient.Text = GetText();

如果您真的想这样做,可以使用
表达式构建器
-我们到处都使用这个通用方法

允许你做什么

<asp:Button ID="BtnAjoutClient" runat="server" Text='<%$ Code :  GetText()%>' />

如果您真的想这样做,可以使用
表达式构建器
-我们到处都使用这个通用方法

允许你做什么

<asp:Button ID="BtnAjoutClient" runat="server" Text='<%$ Code :  GetText()%>' />