Click here to Skip to main content
16,005,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web project where if the user selects a certain value in a dropdown or combo box, text will be added into a textbox. The text is assigned (by looking the debugger) but is not showing on the webpage.
VB
txtMyTextBox.text = ddMydropdown.text

txtMyOtherTextBox = cboMyCombo.text

Is there a refresh that I need to add for the changes to show? All control have the autopostback set to true.
Posted
Updated 3-Oct-11 4:00am
v3
Comments
Simon Bang Terkildsen 3-Oct-11 10:02am    
added ASP.NET tag - the mention of AutoPostBack indicates that this is a ASP.NET web application, and since no other UI framework tag was added; ASP.NET is assumed
walterhevedeich 3-Oct-11 21:20pm    
[Post from OP - Deleted from Answers] I was able to solve the problem by using an Ajax UpdatePanel.
walterhevedeich 3-Oct-11 21:21pm    
DO NOT post comments as Answers. If you have a question/comment, use the Have a question or Comment? widget.

put your controls inside update panel and
at the load event

use

if(IsPostback)
{
return;
}
 
Share this answer
 
Comments
Andy Morris 6-Oct-11 23:21pm    
Thanks for the info. It worked like a charm.
In the code you have provided you are assigning the text of combobox to textbox control.
VB
txtMyOtherTextBox = cboMyCombo.text


here you need to use text property
VB
txtMyOtherTextBox.Text = cboMyCombo.text


Hope this will help you.
 
Share this answer
 
v2
you can use like this
txtMyOtherTextBox .Text=ddMydropdown.SelectedItem.Text;
 
Share this answer
 
v2
Are you checking Page.IsPostback before setting the textbox's text?
 
Share this answer
 
Comments
Andy Morris 3-Oct-11 10:17am    
Is that on the page load event? or under Asp?

I'm new to the web development aspect and trying to figure it all out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900