•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,196 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,191 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1083 | Replies: 17
![]() |
•
•
Join Date: Feb 2008
Posts: 13
Reputation:
Rep Power: 1
Solved Threads: 0
Could someone help me how to add value to A item based on other selected value??(c#)
#1
Mar 12th, 2008
My problem is I want to add in a value to a LABEL based on selected value in the DropDownList !!
Example:
tbl_abc
ID Sequence Name
-----------------------------------------------
1 2 Michael
2 3 Jenny
3 4 Max
4 4 Max
5 2 Michael
6 4 Max
7 3 Jenny
8 5 Alice
-----------------------------------------------
ID-(asp:label)
Sequence-(asp:label)
Name-(asp
ropDownList)
-If I choose Max from the DropDownList then the Sequence_label will automatically generate the 4.
-If I choose Michael from the DropDownLst then the Sequence_label will automatically generate the 2.
Can anyone help me to solve this problem??
Thanks in advance !!
Example:
tbl_abc
ID Sequence Name
-----------------------------------------------
1 2 Michael
2 3 Jenny
3 4 Max
4 4 Max
5 2 Michael
6 4 Max
7 3 Jenny
8 5 Alice
-----------------------------------------------
ID-(asp:label)
Sequence-(asp:label)
Name-(asp
ropDownList)-If I choose Max from the DropDownList then the Sequence_label will automatically generate the 4.
-If I choose Michael from the DropDownLst then the Sequence_label will automatically generate the 2.
Can anyone help me to solve this problem??
Thanks in advance !!
Last edited by hwa : Mar 12th, 2008 at 3:45 am.
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#2
Mar 12th, 2008
•
•
Join Date: Feb 2008
Posts: 13
Reputation:
Rep Power: 1
Solved Threads: 0
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#3
Mar 12th, 2008
Hi sbv,
If I follow the your statement then I only can get the drop down list value and add into the label but what I want is not this.
I want is like this that I mentioned above:
-If I choose Max from the DropDownList then the Sequence_label will automatically generate the 4.
-If I choose Michael from the DropDownLst then the Sequence_label will automatically generate the 2.
Thanks ya
If I follow the your statement then I only can get the drop down list value and add into the label but what I want is not this.
I want is like this that I mentioned above:
-If I choose Max from the DropDownList then the Sequence_label will automatically generate the 4.
-If I choose Michael from the DropDownLst then the Sequence_label will automatically generate the 2.
Thanks ya
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#4
Mar 12th, 2008
hi hwa,
ok. But the meathod i told is right.
You can assign any value to label using this.
Is all values are in Db table? If yes then fetch it as per Records selected in DropDown.
As... on Selected index change.
fire a query something like...
"select Squesnce from tbl_abc where ID = " + DD1.Selectedvalue
and assign its value to label.
Now i have given right solution or still not. Still you need something different ?
If so then i am sorry. I am not clear with your requirement.
Have a good time. Bye.
ok. But the meathod i told is right.
You can assign any value to label using this.
Is all values are in Db table? If yes then fetch it as per Records selected in DropDown.
As... on Selected index change.
fire a query something like...
"select Squesnce from tbl_abc where ID = " + DD1.Selectedvalue
and assign its value to label.
Now i have given right solution or still not. Still you need something different ?
If so then i am sorry. I am not clear with your requirement.
Have a good time. Bye.
Last edited by sbv : Mar 12th, 2008 at 3:59 am.
Accept Challenges and Enjoy Coding... :)
•
•
Join Date: Sep 2007
Posts: 1,057
Reputation:
Rep Power: 4
Solved Threads: 61
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#5
Mar 12th, 2008
you can do it by exactly what he said. An example of this would be:
VB.NET Syntax (Toggle Plain Text)
labelname.Text = dropdownlistname.SelectedItem.Value
•
•
Join Date: Feb 2008
Posts: 13
Reputation:
Rep Power: 1
Solved Threads: 0
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#6
Mar 12th, 2008
•
•
•
•
you can do it by exactly what he said. An example of this would be:
VB.NET Syntax (Toggle Plain Text)
labelname.Text = dropdownlistname.SelectedItem.Value
Hi,
-May I know that this code only can retrieve the selected value in DropDown to the Label right???
-Actually is my misunderstanding or yours not clear about my requirement??
-the data inside tbl_abc is fix !!
-sorry, can yours give more clearly about that
Thanks ya
•
•
Join Date: Feb 2008
Posts: 13
Reputation:
Rep Power: 1
Solved Threads: 0
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#7
Mar 12th, 2008
Hi sbv,
Can you explain more clearly about it because I still confuse about it.
-I retrieve the tbl_abc from sqlDatabase
-I using SqlDataSource(is it needed??)
-I using <asp:Label> for the Sequence (this label will show the value based on the Selected value in the DropDown)
-I using <asp
ropDownList> for the Name (this will choose by the user)
All I do is in the <InsertItemTemplate>
Thanks for give me a hand !!
Can you explain more clearly about it because I still confuse about it.
-I retrieve the tbl_abc from sqlDatabase
-I using SqlDataSource(is it needed??)
-I using <asp:Label> for the Sequence (this label will show the value based on the Selected value in the DropDown)
-I using <asp
ropDownList> for the Name (this will choose by the user)All I do is in the <InsertItemTemplate>
Thanks for give me a hand !!
Re: Could someone help me how to add value to A item based on other selected value??(
#8
Mar 13th, 2008
•
•
•
•
My problem is I want to add in a value to a LABEL based on selected value in the DropDownList !!
Example:
tbl_abc
ID Sequence Name
-----------------------------------------------
1 2 Michael
2 3 Jenny
3 4 Max
4 4 Max
5 2 Michael
6 4 Max
7 3 Jenny
8 5 Alice
-----------------------------------------------
ID-(asp:label)
Sequence-(asp:label)
Name-(aspropDownList)
-If I choose Max from the DropDownList then the Sequence_label will automatically generate the 4.
-If I choose Michael from the DropDownLst then the Sequence_label will automatically generate the 2.
Can anyone help me to solve this problem??
Thanks in advance !!
Hi,
Do you want to assign ID and Sequence values both to the label depending upon the selection of DropDownLst?
•
•
•
•
As you said here -
ID-(asp:label)
Sequence-(asp:label)
Name-(aspropDownList)
As i told you in my last post. On DropDownList's selected index change event
you need to do 2 things.
1) fetch ID and Sequence from db depending upon the DropdownLst value
2) Then assign it to your labels.
Accept Challenges and Enjoy Coding... :)
•
•
Join Date: Feb 2008
Posts: 13
Reputation:
Rep Power: 1
Solved Threads: 0
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#9
Mar 13th, 2008
•
•
Join Date: Mar 2008
Posts: 39
Reputation:
Rep Power: 1
Solved Threads: 7
Re: Could someone help me how to add value to A item based on other selected value??(c#)
#10
Mar 14th, 2008
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Import selected data from .csv and directly import on send_it.asp (ASP)
- Custom Ecommerce (eCommerce)
- Open In New Window Php (PHP)
- add to combobox from listbox in another form (Visual Basic 4 / 5 / 6)
- a Java GUI based program using Swing classes, Vat (Java)
- Want to use radio button or menu bar instead of combo box (Java)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the ASP.NET Forum
- Previous Thread: Log is here. But Code ?? How to get this?
- Next Thread: reading cookie from asp



Linear Mode