[英]how to call a written function in .aspx page from code behind
i have an asp:DropDownList and i want to disable it in some condition.it can happen with a function in aspx page.but from code behind (after some c# work) it wont! 我有一个asp:DropDownList,我想在某种情况下禁用它。它可能会在aspx page。功能中发生,但是从后面的代码(经过一些C#工作)之后就不会了!
this is the element: 这是元素:
ASPX:
ASPX:
<asp:DropDownList ClientIDMode="Static" ID="cmbState" runat="server" Width="130px" Height="30px" Font-Size="Small" Font-Bold="true" DataValueField="StateID" DataTextField="Name" AutoPostBack="True"></asp:DropDownList>
Code-Behind:
代码隐藏:
bool condition = true;
if (condition == true)
{
cmbState.Enabled = false;
}
This should work unless you have something in your Page_Load
method which would counter it. 除非您在
Page_Load
方法中有可以解决该问题的方法,否则此方法应该起作用。
The AutoPostBack
property is important due to the order in which events are carried out on the page. 由于页面上事件的执行顺序,因此
AutoPostBack
属性很重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.