943,582 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 1027
  • ASP.NET RSS
Jul 14th, 2009
0

combobox Value disappears ?

Expand Post »
Hi

I have a form with
1. dropdown (ddTTDBenefitP1)
2. label (lblBenefitPeriodFactor1)

The combobox is populated with listitems
[Text & value]

I applied attributes to this dropdown.

C# Syntax (Toggle Plain Text)
  1. // ddTTDBenefitP1
  2. ddTTDBenefitP1.SelectedIndex = 0;
  3. string ddTTDBenefitP1_script = string.Format("javascript:document.getElementById('{0}').innerText = {1}.options[{1}.selectedIndex].value;", lblBenefitPeriodFactor1.ClientID, ddTTDBenefitP1.ClientID);
  4.  
  5. ddTTDBenefitP1.Attributes.Add("onChange", ddTTDBenefitP1_script);

So when a user changes the selectedItem , the label display's the value of the selected Item.

However, when i save, i need to grab the value of the label.

But for some reason its 0 or blank ... But the actual text is not

Can anyone help ?
Last edited by cVz; Jul 14th, 2009 at 5:11 am.
Similar Threads
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jul 14th, 2009
0

Re: combobox Value disappears ?

The way I tested it it works fine if you don't use a label but a HiddenField
Reputation Points: 32
Solved Threads: 13
Junior Poster in Training
ryuslash is offline Offline
57 posts
since Jul 2009
Jul 14th, 2009
0

Re: combobox Value disappears ?

could be more specific with code....may be i can help you out..?
Reputation Points: 28
Solved Threads: 106
Banned
dnanetwork is offline Offline
633 posts
since May 2008
Jul 14th, 2009
0

Re: combobox Value disappears ?

Ah thanks guys its definately the label , it doenst have postback value ... i forgot

Thanks so much ....
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jul 14th, 2009
0

Re: combobox Value disappears ?

Click to Expand / Collapse  Quote originally posted by cVz ...
Ah thanks guys its definately the label , it doenst have postback value ... i forgot

Thanks so much ....
gud 4 u....Enjoy programming...
Reputation Points: 28
Solved Threads: 106
Banned
dnanetwork is offline Offline
633 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Gridview and dropdownlist
Next Thread in ASP.NET Forum Timeline: Help the begineer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC