Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources


Forums»ASP.NET Forums»



autogenerate the value

hi i am a new user of Aso.Net. Please help me .. its urgent..
In my project i am having Dropdownlists and listboxes and also textboxes.
My question is when ever i click on the dropdownlist value corresponding value of that dropdownlist should be automatically generated.
For example if i select the value of Productname the ProductId should be automatically generated in the textbox.
posted by:anonymous on 5/8/2007 12:00:00 AM
Binding data to a textbox

You need to add code to the SelectedIndexChanged event of your drop down list that will assign the Text of textbox to a value based on the SelectedItem in the drop down list. You could use a switch statement to accomplish this.

swich(ddlProduct.SelectedIndex)
{
case 0:
textbox1.Text = "ProductId1";
break;
case 1:
textbox1.Text = "ProductId2";
break;
//and so on
default:
textbox1.Text = "Product Id not found";
break;
}

Nathan
posted by:Nathan  on 5/9/2007 12:00:00 AM
© 2008 dotnetwatch.com -- Privacy policy

Website Design & Internet Marketing by Shivam