Hello Programmers
I using dropdownlist with autopostback, its working good but if I select a certain value change this value to another value, I have not any update control like panel.
what is a problem?
- <asp:DropDownList runat="server" Font-Size="Medium" Font-Names="Calibri" CssClass="form-control" Width="250px" Height="30" ID="ddl_device" OnSelectedIndexChanged="ddl_device_SelectedIndexChanged" AutoPostBack="True" >
- <asp:ListItem Value="">Select Items</asp:ListItem>
- <asp:ListItem Value="0">CPU</asp:ListItem>
- <asp:ListItem Value="1">Monitor Extra</asp:ListItem>
- <asp:ListItem Value="1">laptop</asp:ListItem>
- <asp:ListItem Value="1">Printer</asp:ListItem>
- <asp:ListItem Value="1">Fax Machine</asp:ListItem>
- <asp:ListItem Value="1">Scanner</asp:ListItem>
- </asp:DropDownList>
- protected void ddl_device_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ddl_device.SelectedValue == "")
- {
- Response.Write("<script>alert('Please you must be Select Type!');</script>");
- }
- else if (ddl_device.SelectedValue == "1")
- {
- TextBox1.Enabled = true;
- TextBox1.Text = "";
- TextBox2.Enabled = false;
- TextBox2.Text = "";
- TextBox3.Enabled = false;
- TextBox3.Text = "";
- }
- else if (ddl_device.SelectedValue == "0")
- {
- TextBox1.Enabled = true;
- TextBox1.Text = "";
- TextBox2.Enabled = true;
- TextBox2.Text = "";
- TextBox3.Enabled = true;
- TextBox3.Text = "";
- }