Brug af autoeventhandler
Hej alleJeg har et spørgsmål vedr denne kode:
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<script runat="server" >
void Selection_Change(Object sender, EventArgs e)
{
// Based on the value selected by the user from the
// DropDownList control the form changes.
if (Bilmærke.SelectedValue == "0")
{
BestillingCJS.Visible = false;
BestillingMB.Visible = false;
}
if (Bilmærke.SelectedValue == "1")
{
BestillingCJS.Visible = false;
BestillingMB.Visible = true;
}
if (Bilmærke.SelectedValue == "2")
{
BestillingCJS.Visible = true;
BestillingMB.Visible = false;
}
}
</script>
<body>
<form id="Form1" runat="server">
<h3> DropDownList Example </h3>
<table cellpadding="5">
<tr>
<td>Vælg biltype:</td>
<td>
<asp:DropDownList Visible="true" id="Bilmærke"
AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Selected="True" Value="0"> Vælg </asp:ListItem>
<asp:ListItem Value="1"> Mercedes-Benz </asp:ListItem>
<asp:ListItem Value="2"> Chrysler-Jeep-Smart </asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:RadioButtonList Visible="false" id="BestillingMB" AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Value="1">Nøgle bestilling</asp:ListItem>
<asp:ListItem Value="2">Generelle spørgsmål</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList Visible="false" ID="BestillingCJS" AutoPostBack="True"
OnSelectedIndexChanged="Selection_Change"
runat="server">
<asp:ListItem Value="1">Nøgle bestilling</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</table>
</form>
</body>
</html>
Jeg får følgende fejl når jeg forsøger at se den i en browser.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'estillingMB' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 17: {
Line 18: BestillingCJS.Visible = false;
Line 19: BestillingMB.Visible = true;
Line 20: }
Line 21:
Source File: D:\Websites\extranet.daimlerchrysler.se\applications\cj\orderkey\test.aspx Line: 19
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Det ville være en stor hjælp hvis nogle kunne hjælpe. Tak på forhånd.
