Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 02, 2012 12:27 PM by darwish.1
Member
154 Points
507 Posts
May 02, 2012 11:49 AM|LINK
Hi,
I had a dropDownList, and I want that when My page load, the DropDownList automatickly choose the value "TI" and block choosing other values
I had to do:
// To choose TI: DropDownList.SelectedValue="TI"
// To block choosing ??
Participant
878 Points
264 Posts
May 02, 2012 11:53 AM|LINK
block other items in
protected void DropDownList_SelectedIndexChanged(object sender,EventArgs e) { if(DropDownList.SelectedValue !="TI") DropDownList.SelectIndex=-1; }
53 Points
44 Posts
May 02, 2012 11:54 AM|LINK
i didnt understand exactly what do you mean
other values should be saved in your database;
you need to retreive them from your databse by binding it to sql;
then you should write in the .cs part of your project the following
string name = DropDownList1.SelectedValue;
and then you can insert into a table the value name from the drop downlist
All-Star
34545 Points
5554 Posts
May 02, 2012 11:55 AM|LINK
salim20001 want that when My page load, the DropDownList automatickly choose the value "TI" and block choosing other values
if you want to block chosing other value by user.... why keep dropdown.... keep it as simple label
you can still block selection of dropdown by making it disabled
DropDownList1.Enabled = false;
hope this helps...
May 02, 2012 12:27 PM|LINK
ok
then you can simply make a lable with one value
or if you insist on a drop downlist, just give it a single value
or in the .cs part of your project just assign the value of the dropdownlist
dropdownlist.selectedvalue="VALUE";
:)
salim20001
Member
154 Points
507 Posts
DropDownList value
May 02, 2012 11:49 AM|LINK
Hi,
I had a dropDownList, and I want that when My page load, the DropDownList automatickly choose the value "TI" and block choosing other values
I had to do:
// To choose TI: DropDownList.SelectedValue="TI"
// To block choosing ??
ZeeshanAnsar...
Participant
878 Points
264 Posts
Re: DropDownList value
May 02, 2012 11:53 AM|LINK
block other items in
protected void DropDownList_SelectedIndexChanged(object sender,EventArgs e) { if(DropDownList.SelectedValue !="TI") DropDownList.SelectIndex=-1; }Please 'Mark as Answer' if this post helps you.
darwish.1
Member
53 Points
44 Posts
Re: DropDownList value
May 02, 2012 11:54 AM|LINK
i didnt understand exactly what do you mean
other values should be saved in your database;
you need to retreive them from your databse by binding it to sql;
then you should write in the .cs part of your project the following
string name = DropDownList1.SelectedValue;
and then you can insert into a table the value name from the drop downlist
kedarrkulkar...
All-Star
34545 Points
5554 Posts
Re: DropDownList value
May 02, 2012 11:55 AM|LINK
if you want to block chosing other value by user.... why keep dropdown.... keep it as simple label
you can still block selection of dropdown by making it disabled
DropDownList1.Enabled = false;
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
darwish.1
Member
53 Points
44 Posts
Re: DropDownList value
May 02, 2012 12:27 PM|LINK
ok
then you can simply make a lable with one value
or if you insist on a drop downlist, just give it a single value
or in the .cs part of your project just assign the value of the dropdownlist
dropdownlist.selectedvalue="VALUE";
:)