I am getting the selectected item value -1 in dropdown list and not showing the actual value
up vote
0
down vote
favorite
I am getting the selectected item value -1 in dropdown list and not showing the actual value
if (ddlperiodunit.Text.Trim() != "Till Further Order")
{
if (txtDt.Text.Trim() == "")
{
MessageBox("DEBARMENT START DT CAN NOT BE BLANK");
txtDt.Focus();
return;
}
if (TxtDebarmentPrd.Text.Trim() == "" || TxtDebarmentPrd.Text.Trim() == "0")
{
MessageBox("DEBARMENT PERIOD CAN NOT BE BLANK");
TxtDebarmentPrd.Focus();
return;
}
}
I am selecting "Till Further Order"
in my drop down list but while debuging sometimes its shows ddlperiodunit.Text.Trim() =-1
asp.net drop-down-menu
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
I am getting the selectected item value -1 in dropdown list and not showing the actual value
if (ddlperiodunit.Text.Trim() != "Till Further Order")
{
if (txtDt.Text.Trim() == "")
{
MessageBox("DEBARMENT START DT CAN NOT BE BLANK");
txtDt.Focus();
return;
}
if (TxtDebarmentPrd.Text.Trim() == "" || TxtDebarmentPrd.Text.Trim() == "0")
{
MessageBox("DEBARMENT PERIOD CAN NOT BE BLANK");
TxtDebarmentPrd.Focus();
return;
}
}
I am selecting "Till Further Order"
in my drop down list but while debuging sometimes its shows ddlperiodunit.Text.Trim() =-1
asp.net drop-down-menu
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you share your code?
– Phoenix
1 hour ago
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
12 mins ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am getting the selectected item value -1 in dropdown list and not showing the actual value
if (ddlperiodunit.Text.Trim() != "Till Further Order")
{
if (txtDt.Text.Trim() == "")
{
MessageBox("DEBARMENT START DT CAN NOT BE BLANK");
txtDt.Focus();
return;
}
if (TxtDebarmentPrd.Text.Trim() == "" || TxtDebarmentPrd.Text.Trim() == "0")
{
MessageBox("DEBARMENT PERIOD CAN NOT BE BLANK");
TxtDebarmentPrd.Focus();
return;
}
}
I am selecting "Till Further Order"
in my drop down list but while debuging sometimes its shows ddlperiodunit.Text.Trim() =-1
asp.net drop-down-menu
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am getting the selectected item value -1 in dropdown list and not showing the actual value
if (ddlperiodunit.Text.Trim() != "Till Further Order")
{
if (txtDt.Text.Trim() == "")
{
MessageBox("DEBARMENT START DT CAN NOT BE BLANK");
txtDt.Focus();
return;
}
if (TxtDebarmentPrd.Text.Trim() == "" || TxtDebarmentPrd.Text.Trim() == "0")
{
MessageBox("DEBARMENT PERIOD CAN NOT BE BLANK");
TxtDebarmentPrd.Focus();
return;
}
}
I am selecting "Till Further Order"
in my drop down list but while debuging sometimes its shows ddlperiodunit.Text.Trim() =-1
asp.net drop-down-menu
asp.net drop-down-menu
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 44 mins ago


Tân Nguyễn
3,54432450
3,54432450
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 1 hour ago
Krishna Chandra Hota
11
11
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Krishna Chandra Hota is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you share your code?
– Phoenix
1 hour ago
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
12 mins ago
add a comment |
Can you share your code?
– Phoenix
1 hour ago
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
12 mins ago
Can you share your code?
– Phoenix
1 hour ago
Can you share your code?
– Phoenix
1 hour ago
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
12 mins ago
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
12 mins ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Krishna Chandra Hota is a new contributor. Be nice, and check out our Code of Conduct.
Krishna Chandra Hota is a new contributor. Be nice, and check out our Code of Conduct.
Krishna Chandra Hota is a new contributor. Be nice, and check out our Code of Conduct.
Krishna Chandra Hota is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370351%2fi-am-getting-the-selectected-item-value-1-in-dropdown-list-and-not-showing-the%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you share your code?
– Phoenix
1 hour ago
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
12 mins ago