Hello,
Still new to this aspx stuff. Some of the code is easier to understand than other parts.
I am trying to add any language script
to the rma.aspx page on the client side to produce a text message based on the rma choice choosen by the customer.
example
drop down list choice: "The item was damaged during shipping"
text message to display to the customer: "Please return the product to the box it came in including all packing materials and wait for instructions from us. We will need to
open a damaged freight claim with the shipping company and will contact you as soon as possible."
I finally found the code to do what I wanted but can't get it to complie on the page without errors.
Here is the code in vb that works on a stand alone page.
http://www.aqua-man.com/cart/dropdownlist2.aspx<%@ Page Language="VB" %>
<script
runat="server">
Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs)
Select Case DropDownList1.SelectedIndex
Case 0: Label1.Text = String.Empty ' Reset the Label1.Text
Case 1: Label1.Text = "You got Grade E!"
Case 2: Label1.Text = "You got Grade D!"
Case 3: Label1.Text = "You got Grade C!"
Case 4: Label1.Text = "You got Grade B!"
Case 5: Label1.Text = "You got Grade A!"
End Select
End Sub
</script
>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="0" Selected="True">- Please select a range of score -</asp:ListItem>
<asp:ListItem Value="1">0 - 20</asp:ListItem>
<asp:ListItem Value="2">21 - 40</asp:ListItem>
<asp:ListItem Value="3">40 - 60</asp:ListItem>
<asp:ListItem Value="4">61 - 80</asp:ListItem>
<asp:ListItem Value="5">81 - 100</asp:ListItem>
</asp:DropDownList>
</p>
<p>
<asp:Label id="Label1" runat="server"></asp:Label>
</p>
</form>
</body>
</html>
Another version in C# that works on a stand alone page:
http://www.aqua-man.com/cart/dropdownlist1.aspx<%@ Page Language="C#" %>
<html>
<head>
<script
Language="C#" Runat="server">
void HandleSelect(object sender, EventArgs e) {
lab.Text = "The selected country has the international car code ";
if (list.SelectedItem != null) lab.Text += list.SelectedItem.Value;
}
</script
>
</head>
<body>
<form Runat="server">
<asp:DropDownList ID="list" OnSelectedIndexChanged="HandleSelect"
AutoPostBack="true" Runat="server" >
<asp:ListItem Text="United States" Value="USA" />
<asp:ListItem Text="Great Britain" Value="GB" />
<asp:ListItem Text="Germany" Value="D" />
<asp:ListItem Text="France" Value="F" />
<asp:ListItem Text="Italy" Value="I" />
</asp:DropDownList><br>
<asp:Label ID="lab" Runat="server" />
</form>
</body>
</html>
It seams that bv5 uses some java script
around the site but I can't get any script
to run without errors like
Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.
Compiler Error Message: BC30451: Name 'ReasonDropDownList' is not declared.
Anyone know how to put a script
on here like this or what I might try next?
Thanks, Brad