hello everyone
i want to firing my dropdownlist without autopostback, this is possible,
below my code
- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
- <ContentTemplate>
- <asp:DropDownList ID="ddlIndustry" runat="server" OnSelectedIndexChanged="ddlIndustry_SelectedIndexChanged"></asp:DropDownList>
- </ContentTemplate>
- <Triggers>
- <asp:AsyncPostBackTrigger ControlID="ddlIndustry" EventName="SelectedIndexChanged" />
- </Triggers>
- </asp:UpdatePanel>
- protected void ddlIndustry_SelectedIndexChanged(object sender, EventArgs e)
- {
-
- StringBuilder builder = new StringBuilder();
-
- 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 ";
- sqlQueryOcc += " inner join SALARY_INDS";
- sqlQueryOcc += " on SALARY_INDS_OCCNAME.INDUS_CODE = SALARY_iNDS.INDUS_CODE ";
- sqlQueryOcc += " where SALARY_INDS.INDUS_CODE = '" + ddlIndustry.SelectedValue + "'";
- using (SqlCommand cmd = new SqlCommand(sqlQueryOcc))
- {
- cmd.CommandType = CommandType.Text;
- cmd.Connection = conn;
- conn.Open();
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- DataTable dt = new DataTable();
- da.Fill(dt);
- foreach (DataRow row in dt.Rows)
- {
- 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());
- }
- conn.Close();
-
- }
- this.occList.Text = builder.ToString();
- }