C# 当下拉列表值更改时尝试更改网页上的标签

C# 当下拉列表值更改时尝试更改网页上的标签,c#,jquery,asp.net,C#,Jquery,Asp.net,在下拉列表中选择不同的下拉值时,尝试更改标签时遇到问题。任何帮助都将不胜感激,以下是该页面的代码 .aspx文件 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="IncidentsListPage.aspx.cs" Inherits="Default2" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <hea

在下拉列表中选择不同的下拉值时,尝试更改标签时遇到问题。任何帮助都将不胜感激,以下是该页面的代码

.aspx文件

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="IncidentsListPage.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Incidents Report</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>

    <asp:DropDownList ID="ddlIncidents" 
    runat="server"DataSourceID="TechSupportDataSource" 
    DataTextField="Tickets" DataValueField="IncidentID" AutoPostBack="True" 
    OnSelectedIndexChanged="ddlIncidents_SelecetedIndexChanged">
    </asp:DropDownList>

  </div>
    <asp:SqlDataSource ID="TechSupportDataSource" runat="server" 
    ConnectionString="<%$ ConnectionStrings:AccessString %>" ProviderName="
    <%$ ConnectionStrings:AccessString.ProviderName %>" 
    SelectCommand="SELECT CSTR(IncidentID) + ' | ' +  ProductCode + ' | ' + 
    Title  AS Tickets, * FROM [Incidents] WHERE ([CustomerID] = ?)">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="1116" Name="CustomerID" 
             SessionField="CustID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:Label ID="Label4" runat="server" Font-Overline="False" Font-
      Size="X-Large" Font-Underline="True" Text="Customer Info"></asp:Label>
    <br />
     &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Name: "> 
    </asp:Label>
    <asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="Contact: ">
    </asp:Label>
    <asp:Label ID="lblContact" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label3" runat="server" Font-Bold="True" Text="Address: ">
    </asp:Label>
    <asp:Label ID="lblAddress" runat="server" Text="Label"></asp:Label>
    <br />
    <asp:Label ID="Label5" runat="server" Font-Size="X-Large" Font-
    Underline="True" Text="Ticket Info"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label6" runat="server" Font-Bold="True" Text="Incident 
    ID: "></asp:Label>
    <asp:Label ID="lblIncidentID" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label7" runat="server" Font-Bold="True" Text="Title: ">
    </asp:Label>
    <asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label8" runat="server" Font-Bold="True" 
     Text="Description: "></asp:Label>
    <asp:Label ID="lblDescription" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label10" runat="server" Font-Bold="True" Text="Date 
     Opened: "></asp:Label>
    <asp:Label ID="lblOpened" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label11" runat="server" Font-Bold="True" Text="Date 
     Closed: "></asp:Label>
    <asp:Label ID="lblClosed" runat="server" Text="Label"></asp:Label>
    <br />
    &nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label9" runat="server" Font-Bold="True" Text="Technician 
     Name: "></asp:Label>
    <asp:Label ID="lblTechnician" runat="server" Text="Label"></asp:Label>
   </form>
   </body>
   </html>

到底是什么问题?看起来你根本没有处理“DDL事件”\u SeleceededIndexchange“,我忘了把它拿出来,我正在寻找方法,当下拉列表中有一个选择时,我可以如何更改页面上显示的标签,但我不知道如何用我的代码实现它。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Default2 : System.Web.UI.Page
{
private Incident incident;
protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    {
        ddlIncidents.DataBind();
    }
    incident = this.GetIncident();
    lblName.Text = Session["CustomerName"].ToString();
    lblContact.Text = Session["CustomerContact"].ToString();
    lblAddress.Text = Session["CustomerAddress"].ToString();
    lblIncidentID.Text = incident.incidentNum;
    lblTitle.Text = incident.title;
    lblDescription.Text = incident.description;
    lblOpened.Text = incident.dateOpen;
    lblClosed.Text = incident.dateClosed;
    lblTechnician.Text = incident.techName;
}

private Incident GetIncident()
{
    DataView incidentTable = (DataView)
       TechSupportDataSource.Select(DataSourceSelectArguments.Empty);

    DataRowView row = incidentTable[0];

    Incident i = new Incident();
    i.incidentNum = row["IncidentID"].ToString();
    i.productName = row["ProductCode"].ToString();
    i.title = row["Title"].ToString();
    i.techName = row["TechID"].ToString();
    i.dateOpen = row["DateOpened"].ToString();
    i.dateClosed = row["DateClosed"].ToString();
    i.description = row["Description"].ToString();

    return i;
}
}