如何启用下拉列表 [英] How to Enable a Dropdownlist

查看:91
本文介绍了如何启用下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  protected   void  DropDownList2_SelectedIndexChanged(对象发​​件人,EventArgs e)
{
尝试
{
if (Label5.Text.Trim()== Label13.Text.Trim())
{
DropDownList2.Enabled = ;
}
SqlConnection dbconn = new SqlConnection(ConfigurationManager.ConnectionStrings [ UsersConnectionString]的ConnectionString)。
dbconn.Open();
// string sqltemp =从Status_Remarks中选择OutgoingRequestID ='+ Label10.Text +' ;
// SqlCommand com = new SqlCommand(sqltemp,dbconn);
string sqltemp1 = update Status_Remarks set Div_Officer_Remarks =' + DropDownList1.Text + '其中OutgoingRequestID =' + Label10。文字+ ';
com = new SqlCommand(sqltemp1,dbconn);
com.ExecuteNonQuery();
dbconn.Close();
}





我正在使用此编码来启用Dropdownlist2,但它仍然被禁用,即使条件符合

请帮助解决

解决方案

当你开始运行下拉列表时启用它是假的它正在改变它自己选择的索引改变事件....

Hello Anup,



首先尝试在您的代码中找到您设置 DropDownList2.Enabled = false; 然后设置调试器点。然后调试你的代码,你就会知道 DropDownList 控件被禁用的位置/时间。



< b>注意:请检查您是否在ASPX页面中设置了该属性。



- DD


protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
      {
          try
          {
              if (Label5.Text.Trim() == Label13.Text.Trim())
              {
                  DropDownList2.Enabled = true;
              }
              SqlConnection dbconn = new SqlConnection(ConfigurationManager.ConnectionStrings["UsersConnectionString"].ConnectionString);
              dbconn.Open();
              //string sqltemp = "select from Status_Remarks where OutgoingRequestID ='" + Label10.Text + "' ";
              //SqlCommand com = new SqlCommand(sqltemp, dbconn);
              string sqltemp1 = "update Status_Remarks set Div_Officer_Remarks='" + DropDownList1.Text + "'where OutgoingRequestID ='" + Label10.Text + "'";
              com = new SqlCommand(sqltemp1, dbconn);
              com.ExecuteNonQuery();
              dbconn.Close();
          }



I am using this coding to enable the Dropdownlist2, But it remains disabled, even when condition meets
Please help to solve

解决方案

when you start running dropdown enabled is false it's changing in it's own selected index changed event....


Hello Anup,

First try to find in your code where you've set DropDownList2.Enabled = false; and then set debugger points. Then debug your code, you will come to know where/when the DropDownList control is getting disabled.

Note: Please check if you have set the property in ASPX page.

- DD


这篇关于如何启用下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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