Search code examples
asp.netvb.netaspwizard

asp.net use value from one control in a wizard step as value of another in a subsequent step


I have next to no knowledge of asp.net and I need a quick solution.

I have a asp:WizardStep to which I have added a dropdown, like so:

<asp:DropDownList ID="picklistname" runat="server">
  <asp:ListItem value="abc" selected="True">abc</asp:ListItem>
  <asp:ListItem value="def">def</asp:ListItem>
  <asp:ListItem value="ghijk">ghijk</asp:ListItem>
</asp:DropDownList>

That shows up when I run it.

In a later wizard step I have a textbox control, and I want to put the value of the previous dropdown into it, something like this:

<asp:TextBox runat="server" Text="value from picklistname" ID="...

Can this be done and if so, how?

The page language is vb.

I don't have access to the code behind - in fact I can't even find the code behind file so I suspect it has been compiled and the source code is not there anymore.

EDIT

I have managed to get a bit closer:

I added a hidden field (regular html - not asp control) outside of the wizard.

I then added onchange="copyToPickList(this)" to the dropdown control. The copyToPickList function just copies the value of the dropdown to the hidden field.

In the step with the text box, I can add a onclick and call a function that copies the hidden field into the textbox.

So now my question is how to get the textbox having this value automatically (on page load)?


Solution

  • OK - its a bit naff, but I added some script in the textbox step that populated the textbox after a certain time elapsed giving the control time to render the textbox.