I have two dropdownlists ,selecting the first dropdown causes postback and second dropdown gets binded...
- Why does the selected value of the first dropdown,once again selected does not cause postback?
EDIT:
<asp:DropDownList ID="DLMatName" runat="server" OnSelectedIndexChanged="DlMeasurement_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
protected void DlMeasurement_SelectedIndexChanged(object sender, EventArgs e)
{
if (DLMatName.SelectedIndex != 0)
{
DataTable dt = _materialInController.GetMeasurementsforMaterials(Convert.ToInt64(DLMatName.SelectedValue.ToString())).Tables[0];
if (dt.Rows.Count > 1)
{
MeasurementTr.Visible = true;
this.DlMeasurement.DataSource = dt;
this.DlMeasurement.DataValueField = dt.Columns[0].ToString();
this.DlMeasurement.DataTextField = dt.Columns[1].ToString();
this.DlMeasurement.DataBind();
this.DlMeasurement.Items.Insert(0, ListItem.FromString("Select"));
this.LblMeasuremet.Visible = false;
ErrorMsg.InnerHtml = "";
}
else if (dt.Rows.Count == 1)
{
this.LblMeasuremet.Visible = true;
this.LblMeasuremet.Text = dt.Rows[0].ItemArray[1].ToString();
MeasurementTr.Visible = false;
ErrorMsg.InnerHtml = "";
}
else
{
}
}
else
{
MeasurementTr.Visible = false;
this.LblMeasuremet.Visible = false;
ErrorMsg.InnerHtml = "Select the materialType";
}
ScriptManager.RegisterClientScriptBlock(DLMatName, typeof(DropDownList), "Hideimage", "HideImageButtonDivforAdd();", true);
}
First time a selected value postbacks,the same when selected second time doesn't postback...