TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abdalla Elawad
NA
1k
216.6k
Dropdownlist change value automatically in AutoPostBack
Sep 17 2019 5:14 AM
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 =
""
;
}
Reply
Answers (
2
)
DKIM mail for HTML body
Send recording by mail to recipients in twilio voice call