2013-05-01 2 views
1

을 발사하지드롭 내가 드롭 다운 목록이있는 페이지가 OnSelectedIndexChanged

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> 
    <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> 
    <asp:ListItem>Cellsite</asp:ListItem> 
    <asp:ListItem>Agreement</asp:ListItem> 
    <asp:ListItem>Event</asp:ListItem> 
    <asp:ListItem>User</asp:ListItem> 
</asp:DropDownList> 
<asp:Label runat="server" ID="EntityName"></asp:Label> 
<ig:WebScriptManager ID="WebScriptManager1" runat="server"></ig:WebScriptManager> 
<ig:WebDataGrid ID="EntityGrid" runat="server" Width="100%"> 
    <Behaviors> 
     <ig:Sorting> 
     </ig:Sorting> 
    </Behaviors> 
</ig:WebDataGrid> 

코드 뒤에 레이블의 SelectedIndexChanged 이벤트를 업데이트되지 않습니다 somereason를 들어

 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
    { 
     EntityName.Text = DropDownList1.SelectedItem.Text; 
    } 

전혀 발사하지입니다 이 이벤트에서 동적 그리드를 추가해야합니다. 어떤 단서?

+4

설정 드롭 다운 속성의 AutoPostBack = "true"로 –

답변

4

당신은 드롭 다운

<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true"> 

당신은 실제로 당신이 AutoPostBack을 = 진정한 속성이없는 다시 더 포스트가 없음을 알 수 있습니다에 AutoPostBack을 추가해야합니다.

0

설정 드롭 다운리스트 속성의 AutoPostBack = "true"를

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> 
    <asp:ListItem>Cellsite</asp:ListItem> 
    <asp:ListItem>Agreement</asp:ListItem> 
    <asp:ListItem>Event</asp:ListItem> 
    <asp:ListItem>User</asp:ListItem> 
    </asp:DropDownList> 
관련 문제