网格视图中的下拉列表不起作用

本文关键字:下拉列表 不起作用 视图 网格 | 更新日期: 2023-09-27 18:16:51

Aspx Code:

  <asp:GridView ID="PaperReviewing" runat="server" CellPadding="4" EmptyDataText="There is no Submission"DataKeyNames="PaperId" RowStyle-Wrap="true"  OnRowDataBound="PaperReviewing_RowDataBound">
              <Columns>
             <asp:TemplateField HeaderText="Action" ControlStyle-Width="200px" >
                <ItemTemplate>
                    <br />
                    <asp:HyperLink ID="HyperLink3" Target="_blank" ForeColor="Black" onclick="javascript:window.open(this.href,'ManuScript Details','resizable=no,scroll bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');return true;"
                    NavigateUrl='<%# String.Format("~/EditorsInChief/DownloadSubFileList.aspx?ID={0}", Eval("PaperId")) %>' runat="server">File Inventory</asp:HyperLink>
                  <br /><asp:HyperLink ID="HyperLink4" Target="_blank" ForeColor="Black" onclick="javascript:window.open(this.href,'ManuScript Details','resizable=no,scroll bars=yes,status=no,toolbar=yes,height=500,width=700,left=50,top=40');return true;"
                  NavigateUrl='<%# String.Format("~/EditorsInChief/SelectReviewer.aspx?ID={0}", Eval("PaperId")) %>' runat="server">Select Another Reviewer</asp:HyperLink>
                    <br />
                                   </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="PaperId" HeaderText="PaperId" InsertVisible="False" 
            ReadOnly="True" SortExpression="PaperId" Visible="False" />
        <asp:BoundField DataField="ManuScriptId" HeaderText="ManuScript Number" 
            SortExpression="ManuScriptId" />
        <asp:BoundField DataField="Type" HeaderText="Article Type" SortExpression="Type" />
           <asp:TemplateField HeaderText="Article Title" HeaderStyle-Wrap="true"  ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" SortExpression="PaperTitle" ControlStyle-Width="200px">
                 <ItemTemplate>
                     <asp:Label ID="Label4" runat="server" Text='<%# Bind("PaperTitle") %>'></asp:Label>
                 </ItemTemplate>
             </asp:TemplateField>
 <asp:BoundField DataField="ReviewerName" HeaderText="Reviewer Name" SortExpression="ReviewerName" />
        <asp:BoundField DataField="Status" HeaderText="Current Status" 
            SortExpression="Status" />
            <asp:BoundField DataField="CreatedDate" HeaderText="Intital Date Submission" SortExpression="CreatedDate" />                
            <asp:BoundField DataField="DateReviewInvited" HeaderText="Date Review Invited" 
                                    SortExpression="DateReviewInvited" />
                                           <asp:BoundField DataField="DateReviewDue" HeaderText="Date Review Due" 
                                    SortExpression="DateReviewDue" />
             <asp:TemplateField HeaderText="EIC Decision">
                 <ItemTemplate>
                     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"
                         onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                     <asp:ListItem Selected="True" Text="Choose Option"></asp:ListItem>
                     <asp:ListItem Text="Accept" Value="Accept"></asp:ListItem>
                     <asp:ListItem Text="Reject" Value="Reject"></asp:ListItem>
                     <asp:ListItem Text="Minor Revision" Value="MinorRevision"></asp:ListItem>
                     <asp:ListItem Text="Major Revision" Value="MajorRevision"></asp:ListItem>
                     </asp:DropDownList>
                 </ItemTemplate>
             </asp:TemplateField>
    </Columns>
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" BorderStyle="Double" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#2461BF" />
    <AlternatingRowStyle BackColor="White"  />
</asp:GridView>

c#代码:

<>之前DropDownList1_SelectedIndexChanged(对象发送者,EventArgs e){DropDownList1 = (DropDownList)发送者;GridViewRow grdrDropDownRow = ((GridViewRow) dropdownlist . parent . parent);}保护无效PaperReviewing_RowDataBound(对象发送者,GridViewRowEventArgs e){如果(e.Row。RowType == DataControlRowType.DataRow){DropDownList ddl = e.l row . findcontrol ("DropDownList1") as DropDownList;If (ddl != null){ddl。SelectedIndexChanged += new eventandler (DropDownList1_SelectedIndexChanged);}}}之前

下拉选定的交换事件不触发。我试图做我的下拉值更改在运行时,在我的数据库值得到更新。

网格视图中的下拉列表不起作用

PaperReviewing_RowDataBound中删除事件处理程序添加代码,因为您已经从标记中附加了它

页面加载

protected void Page_Load(object sender, EventArgs e)
{
  if(!Page.IsPostBack)
  {
    DataBindGrid();
  }
}