2016-03-04 114 views

回答

1

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> 

代码隐藏:

bool condition = true; 
if (condition == true) 
{ 
    cmbState.Enabled = false; 
} 

这应该工作,除非你有你的Page_Load方法的东西这会发生知道它。
AutoPostBack属性很重要,因为事件在页面上执行的顺序。

+0

thanx man.i真的很感谢你的回复 –