Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Select Case
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Select Case

 Post Reply Post Reply
Author
ziwez0 View Drop Down
Groupie
Groupie


Joined: 15 July 2002
Location: United Kingdom
Status: Offline
Points: 144
Post Options Post Options   Thanks (0) Thanks(0)   Quote ziwez0 Quote  Post ReplyReply Direct Link To This Post Topic: Select Case
    Posted: 03 July 2003 at 11:02am

Imhaving trouble trying to grasp a few things, but the problem im facing @ the moment is trying to display  a drop down menu on a select case
following code...

<script language="vb" runat="server">
Sub Page_Load()
  If Page.IsPostBack Then
    Select Case(number.SelectedItem.Value)
      Case "1":
        Message.Text = "<asp:dropdownlist id='list1' runat='server'>" & _
"<asp:listitem>7</asp:listitem>" & _
"<asp:listitem>8</asp:listitem>" & _
"<asp:listitem>9</asp:listitem>" & _
"</asp:dropdownlist>"
      Case "2":
        Message.Text = "hello2"
      Case "3":
        Message.Text = "hello 3"
      Case else
        Message.Text = "0000"
    End Select
  End If
End Sub
</script>

  <form runat="server">
  Select your choice:
  <br><br>
  <asp:radiobuttonlist id="number" runat="server">
    <asp:listitem>1</asp:listitem>
    <asp:listitem>2</asp:listitem>
    <asp:listitem>3</asp:listitem>
  </asp:radiobuttonlist>
  <br><br>
  <input type="submit" value="Submit Choice">
  <br><br>
  <asp:label id="message" runat="server"/>
</form>

the code works, but if you choose case 1 it does not display a drop down menu it will just write "789" any help with this matter would be a great help.

If anything takes long to do its worth doing.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 08 July 2003 at 12:19pm

the ASP engine does exactly as told to.. it fills the control "message" with a text value.... it has zero idea to "evaluate" it....

make another dropdownlist control with the values, and start it off as "Visible=False", and if it meets your criteria (first dropdown = 1), then switch visibility to "True"... otherwise fill in the text value of "message"

Contribute to the working anarchy we fondly call the Internet
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.