Ekrem Tapan

Ekrem Tapan

  • NA
  • 967
  • 81.7k

not firing dropdownlist without autopostback

May 19 2016 3:20 AM
hello everyone 
 
i want to firing my dropdownlist without autopostback, this is possible,
 
below my code
 
  1. <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
  2.                                                 <ContentTemplate>  
  3.                                                     <asp:DropDownList ID="ddlIndustry" runat="server" OnSelectedIndexChanged="ddlIndustry_SelectedIndexChanged"></asp:DropDownList>  
  4.                                                 </ContentTemplate>  
  5.                                                 <Triggers>  
  6.                                                     <asp:AsyncPostBackTrigger ControlID="ddlIndustry" EventName="SelectedIndexChanged" />  
  7.                                                 </Triggers>  
  8.                                             </asp:UpdatePanel>  
  1. protected void ddlIndustry_SelectedIndexChanged(object sender, EventArgs e)  
  2.     {  
  3.   
  4.         StringBuilder builder = new StringBuilder();  
  5.    
  6.         string sqlQueryOcc = "select SALARY_INDS_OCCNAME.INDUS_CAT_VAL,SALARY_INDS_OCCNAME.INDUS_CAT_NAME,SALARY_INDS_OCCNAME.INDUS_CAT_CODE from SALARY_INDS_OCCNAME ";  
  7.         sqlQueryOcc += " inner join SALARY_INDS";  
  8.         sqlQueryOcc += " on SALARY_INDS_OCCNAME.INDUS_CODE = SALARY_iNDS.INDUS_CODE ";  
  9.         sqlQueryOcc += " where SALARY_INDS.INDUS_CODE = '" + ddlIndustry.SelectedValue + "'";  
  10.         using (SqlCommand cmd = new SqlCommand(sqlQueryOcc))  
  11.         {  
  12.             cmd.CommandType = CommandType.Text;  
  13.             cmd.Connection = conn;  
  14.             conn.Open();  
  15.             SqlDataAdapter da = new SqlDataAdapter(cmd);  
  16.             DataTable dt = new DataTable();  
  17.             da.Fill(dt);  
  18.             foreach (DataRow row in dt.Rows)  
  19.             {  
  20.                 builder.AppendFormat("<li><span><input type='checkbox' name='sel_items[]' value='{0}' /></span>{1}</li>", row["INDUS_CAT_CODE"].ToString(), row["INDUS_CAT_NAME"].ToString());  
  21.             }  
  22.             conn.Close();  
  23.            
  24.         } 
  25.   this.occList.Text = builder.ToString();  
  26.     } 


Answers (1)