• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Populating Text fields from dropdown choice

I have a table that I loop through to populate a dropdown list and I want to populate text fields with data based on what the user selects from the dropdown menu. The data I want to output in the textfields is not the same as the value set in the option fields, but does correspond with that row. Any help is much appreciated.
Thanks
0
csaexperts
Asked:
csaexperts
  • 5
  • 2
2 Solutions
 
Anil GolamariCommented:
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
  function AssigntoTextBox(dropDown) {
   dropDown.parentNode.parentNode.childNodes[1].childNodes[0].value = dropDown.value;
  }
 </script>

     
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:TextBox runat="server" ID="tbName" />

        <asp:DropDownList ID="ddlName" onchange="AssigntoTextBox(this)" runat="server">
      <asp:ListItem>AAA</asp:ListItem>
      <asp:ListItem>BBB</asp:ListItem>
      <asp:ListItem>CCC</asp:ListItem>
     </asp:DropDownList>

   
    </div>
    </form>
</body>
0
 
csaexpertsAuthor Commented:
Thanks lucky85 for the help, tried the code which you have mentioned about but it didnt work.
Thanks
0
 
Anil GolamariCommented:
It worked for me. What I did was, I had a drop down to a page and a text box. Now when ever a user changes the selection on the drop down that value will be apperead on the textbox. Are you looking something like this right?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
csaexpertsAuthor Commented:
Not exactly; when the user selects from the dropdown menu. The data I want to output in the textfields is not the same as the value set in the option fields, but does correspond with that row.
0
 
docnicaCommented:
Your in the coldfusion area, is that right? and if yes, do you need a flash form example or a bind example with html and ajax?
0
 
csaexpertsAuthor Commented:
I think bind example with html and ajax would be great.
0
 
csaexpertsAuthor Commented:
Able to solve the problem using ajax
0
 
csaexpertsAuthor Commented:
Able to solve the problem using Ajax
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now