Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

issue when populating data in textbox on dropdownlist box selection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dhananjay - 18 Dec 2007 07:05 GMT
Hi all,

i have a webpage on which
first thing i am adding record using textboxadd and buttonadd.
------
this works fine
second thing i have dropdownlist box on which i will select an item,
based on this selection , i have another textboxforedit(this textbox
will be populated with dropdownlist box selected item).
in this textboxforedit i will modify the data and i have a update
button,if i click update button, it should be updated in the table.

please help me to solve this problem.it's urgent
please send me some code  to solve this issue.

Thanks in advance
Dhananjay
Mike Placentra II - 23 Dec 2007 03:55 GMT
> ...i have dropdownlist box on which i will select an item,
> based on this selection , i have another textboxforedit(this textbox
> will be populated with dropdownlist box selected item).
> in this textboxforedit i will modify the data and i have a update
> button,if i click update button, it should be updated in the table.

This is nothing complicated, I'm assuming you are trying to use a
DropDownList to prefill a TextBox so people don't have to type common
things.

What you need to do is create a DropDownList with the AutoPostBack
attribute set to True, and then handle it's SelectedIndexChanged event
to set the Text property to the value of the SelectedValue property of
the DropDownList:

<asp:DropDownList ... AutoPostBack="True">
 <asp:ListItem Selected="True">Pre-typed things</asp:ListItem>
 ...
</asp:DropDownList>
<asp:TextBox ... />

Here's an outline of how you would handle the event:

Sub DropDownList1_SelectedIndexChanged(sender as object, ...)
Handles ...
 TextBox1.Text = CType(sender, DropDownList).SelectedValue
End Sub

I'm not sure what you mean by updating the database, it's unstated
whether this is a new record or editing a record, if there is already
existing code that this will work alongside, etc. You will have to
explain your problem further.

-Michael Placentra II

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.