Hello everyone,
Please am working on a project basically for storing personal data for some employees. I have a dropdownlistbox which gets its content from a table in SQL-Server. I also have a textbox which i want its text to be the same with the selectedted item of the dropdownlist but it seems not to be working

Here's my simple code which was inplemented in the dropdownlistbox_Selectedindexchanged Procedure:

TextBox1.Text = DropdownListBox1.SelectedItem.ToString
TextBox1.Text = DropdownListBox1.Selectedtext.ToString

or

TextBox1.Text = DropdownListBox1.Text.ToString

try these two..

Hi pgmer, i've tried that before and it shows nothing on the textbox. Am actually not a newbie so am also surprised that did not work. Its actually the VS2010 Professional so am wondering if there's any change in the process. Please help

TextBox1.Text = DropdownListBox1.Text.ToStringTextBox1.Text = DropdownListBox1.Text.ToString()[

This should work man... :( i dont know whats the problem. can u paste ur code here if u can?

chibex64,

My first thought is to debug and make sure that the event is actually getting fired, I'm guessing you know how to do that and have done so already.

That said, I'm using the same set up as you are VS 2010 Professional. I normally use

TextBox.Text = DropDown1.SelectedValue;

to accomplish a similar thing, have you tried this? I know it is very similar to what was stated above, but that's what works for me in VS2010.

Also, it's not a bad idea while debugging to check the selected value of the drop down. Again, I'm fairly certain you have already tried this, but a thought if you haven't.

i think you are binding dropdown data in pageload event.
try below code..
if(!page.ispostback)
{
dropdownlistbinding();
}

now you will get values in textbox using dropdown values

Thanks Crishlay, but ma not doing that in a page_load event. Its in the selectedindexChanged event of the dropdown control and it does not work. i really dont know whats wrong.

Yousuf, how many time do i have to show my code? well, here it is:

Textbox1.text = DropDownList.text.tostring

textbox1.text = DropDownList.selecteditem.text

all these have been tried, none seems to be working. I dont know if there's a problem somewhere

Textbox1.text = DropDownList.text.tostring() Try this... Sumtines if u miss paranthysis for .tostring method it wont work