R
Rob Rogers
My code creates a dynamic hyperlink from drop down list, and a
textbox, but has to wait for autopostback to complete for the
hyperlink to be valid. So is there a way to execute my hyperlink
programmatically in my "SetState" proc that sets up the hyperlink url.
I have to have the target frame, so I can't use Response.Redirect.
Here is my code.
<%@Page Explicit="True" Language="VB" Debug="True" %>
<HTML>
<script runat="server">
Sub SetState(Sender As Object, E As EventArgs)
HyperLink1.NavigateUrl = "http://www.natltc.com/search.aspx?St=" &
JumpTo.SelectedItem.Value & "?City=" & CityBox.text
End Sub
</script>
<body>
<h1>City & State<BR>
</h1>
<form runat="server">
<P>
<asp:TextBox id="CityBox" runat="server" autopostback="true"
OnTextChanged= "SetState"></asp:TextBox><BR>
Enter City</P>
<P> </P>
<P>
<asp:dropdownlist id="JumpTo" runat="server" autopostback="true"
OnSelectedIndexChanged="SetState">
<asp:listitem></asp:listitem>
<asp:listitem>AL</asp:listitem>
<asp:listitem>AK</asp:listitem>
<asp:listitem>AZ</asp:listitem>
<asp:listitem>TX</asp:listitem>
<asp:listitem>OK</asp:listitem>
</asp:dropdownlist><BR>
Select State</P>
<P><br>
<br>
</ASP:IMAGEBUTTON>
<asp:HyperLink id="HyperLink1" runat="server" Target="mainFrame"
NavigateUrl="http://www.natltc.com/search.aspx">HyperLink</asp:HyperLink></P>
</form>
</body>
</HTML>
textbox, but has to wait for autopostback to complete for the
hyperlink to be valid. So is there a way to execute my hyperlink
programmatically in my "SetState" proc that sets up the hyperlink url.
I have to have the target frame, so I can't use Response.Redirect.
Here is my code.
<%@Page Explicit="True" Language="VB" Debug="True" %>
<HTML>
<script runat="server">
Sub SetState(Sender As Object, E As EventArgs)
HyperLink1.NavigateUrl = "http://www.natltc.com/search.aspx?St=" &
JumpTo.SelectedItem.Value & "?City=" & CityBox.text
End Sub
</script>
<body>
<h1>City & State<BR>
</h1>
<form runat="server">
<P>
<asp:TextBox id="CityBox" runat="server" autopostback="true"
OnTextChanged= "SetState"></asp:TextBox><BR>
Enter City</P>
<P> </P>
<P>
<asp:dropdownlist id="JumpTo" runat="server" autopostback="true"
OnSelectedIndexChanged="SetState">
<asp:listitem></asp:listitem>
<asp:listitem>AL</asp:listitem>
<asp:listitem>AK</asp:listitem>
<asp:listitem>AZ</asp:listitem>
<asp:listitem>TX</asp:listitem>
<asp:listitem>OK</asp:listitem>
</asp:dropdownlist><BR>
Select State</P>
<P><br>
<br>
</ASP:IMAGEBUTTON>
<asp:HyperLink id="HyperLink1" runat="server" Target="mainFrame"
NavigateUrl="http://www.natltc.com/search.aspx">HyperLink</asp:HyperLink></P>
</form>
</body>
</HTML>