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
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
Can you share your code?
– Phoenix
Nov 19 at 7:53
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
Nov 19 at 8:44
Show us the way you fill the dropdownlist (Events, Datasource or AddItems...)
– Jortx
Nov 19 at 9:57
And also In what event the code that you show is placed
– Jortx
Nov 19 at 10:42
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
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
edited Nov 19 at 8:12
Tân Nguyễn
1
1
asked Nov 19 at 7:49
Krishna Chandra Hota
11
11
Can you share your code?
– Phoenix
Nov 19 at 7:53
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
Nov 19 at 8:44
Show us the way you fill the dropdownlist (Events, Datasource or AddItems...)
– Jortx
Nov 19 at 9:57
And also In what event the code that you show is placed
– Jortx
Nov 19 at 10:42
add a comment |
Can you share your code?
– Phoenix
Nov 19 at 7:53
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
Nov 19 at 8:44
Show us the way you fill the dropdownlist (Events, Datasource or AddItems...)
– Jortx
Nov 19 at 9:57
And also In what event the code that you show is placed
– Jortx
Nov 19 at 10:42
Can you share your code?
– Phoenix
Nov 19 at 7:53
Can you share your code?
– Phoenix
Nov 19 at 7:53
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
Nov 19 at 8:44
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
Nov 19 at 8:44
Show us the way you fill the dropdownlist (Events, Datasource or AddItems...)
– Jortx
Nov 19 at 9:57
Show us the way you fill the dropdownlist (Events, Datasource or AddItems...)
– Jortx
Nov 19 at 9:57
And also In what event the code that you show is placed
– Jortx
Nov 19 at 10:42
And also In what event the code that you show is placed
– Jortx
Nov 19 at 10:42
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Nov 19 at 7:53
Did you tried to set AutoPostback='true' property for your DropDownlist ? please take a look at AutoPostBack for more info.
– MKH
Nov 19 at 8:44
Show us the way you fill the dropdownlist (Events, Datasource or AddItems...)
– Jortx
Nov 19 at 9:57
And also In what event the code that you show is placed
– Jortx
Nov 19 at 10:42