根据下拉列表选择动态设置 asp:TableRow 位置

本文关键字:asp TableRow 位置 设置 动态 下拉列表 选择 | 更新日期: 2023-09-27 18:35:33

<div id="div1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel3" runat="server">
        <ContentTemplate>
            <asp:Table ID="Table1" runat="server" border="0" CssClass="SupplierFormTable" HorizontalAlign="Center" Width="100%">
                <asp:TableHeaderRow>
                    <asp:TableHeaderCell HorizontalAlign="Left" ColumnSpan="8">       Approval Sequence        </asp:TableHeaderCell>
                </asp:TableHeaderRow>
                <asp:TableRow>
                    <asp:TableCell Width="22%">
                     1.
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Seq1" runat="server" Width="35%" AppendDataBoundItems="true">
                            <asp:ListItem Text="--select--" Value="-1"></asp:ListItem>
                        </asp:DropDownList>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Width="22%">
                    2.
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Seq2" runat="server" Width="35%" AppendDataBoundItems="true">
                            <asp:ListItem Text="--select--" Value="-1"></asp:ListItem>
                        </asp:DropDownList>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Width="22%">
                    3.
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Seq3" runat="server" Width="35%" AppendDataBoundItems="true">
                            <asp:ListItem Text="--select--" Value="-1"></asp:ListItem>
                        </asp:DropDownList>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Width="22%">
                    4.
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Seq4" runat="server" Width="35%" AppendDataBoundItems="true">
                            <asp:ListItem Text="--select--" Value="-1"></asp:ListItem>
                        </asp:DropDownList>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Width="22%">
                    5.
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Seq5" runat="server" Width="35%" AppendDataBoundItems="true">
                            <asp:ListItem Text="--select--" Value="-1"></asp:ListItem>
                        </asp:DropDownList>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Width="22%">
                    6.
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Seq6" runat="server" Width="35%" AppendDataBoundItems="true">
                            <asp:ListItem Text="--select--" Value="-1"></asp:ListItem>
                        </asp:DropDownList>
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

我在div 标签内有这个表。

<div id="div_Approvals" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Table ID="tbl_Approvals" runat="server" border="0" CssClass="SupplierFormTable" HorizontalAlign="Center" Width="100%">
                <asp:TableHeaderRow>
                    <asp:TableHeaderCell HorizontalAlign="Left" ColumnSpan="8">
                     Approval                                             
                    </asp:TableHeaderCell>
                </asp:TableHeaderRow>
                <asp:TableRow  >
                    <asp:TableCell Width="22%">
                        <asp:Label runat="server" ID="lbl_HiringManager" Text="Hiring Manager :"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_HiringManagerName" runat="server" Width="35%"></asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_HiringManagerSignature" runat="server"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_HiringManagerDate" runat="server" ReadOnly="true" Visible="false"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell></asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_HiringManagerComment" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:Button ID="btn_HiringManagerApprove" Text="Approve" runat="server" OnClick="btn_HiringManagerApprove_Click" />
                        <asp:Button ID="btn_HiringManagerReApprove" Text="Re-Approve" runat="server" OnClick="btn_HiringManagerReApprove_Click" Visible="false" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow >
                    <asp:TableCell>
                        <asp:Label runat="server" ID="lbl_ReportingGroupExecutive" Text="Reporting Group Executive :"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_ReportingGroupName" runat="server" Width="35%"></asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_ReportingGroupExecutiveSignature" runat="server"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_ReportingGroupExecutiveDate" runat="server" Visible="false"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell></asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_ReportingGroupExecutiveComment" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:Button ID="btn_ReportingGroup_Approve" Text="Approve" runat="server" OnClick="btn_ReportingGroup_Approve_Click" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:Label runat="server" ID="lbl_ProgramOrProjectOwner" Text="Program/Project Owner (if applicable) :"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_PPO_Name" runat="server" Width="35%"></asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_ProgramOrProjectOwnerSignature" runat="server"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_ProgramOrProjectOwnerDate" runat="server" ReadOnly="true" Visible="false"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell></asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_ProgramOrProjectOwnerComment" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:Button ID="btn_PPO_Approve" Text="Approve" runat="server" OnClick="btn_PPO_Approve_Click" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:Label runat="server" ID="lbl_Finance" Text="Finance"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_Finance" runat="server" Width="35%"></asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_FinanceSignature" runat="server"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_FinanceDate" runat="server" ReadOnly="true" Visible="false"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell></asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_FinanceComment" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:Button ID="btn_Finance_Approve" Text="Approve" runat="server" OnClick="btn_Finance_Approve_Click" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:Label runat="server" ID="lbl_PresidentAndCOO" Text="President & COO (if applicable) :"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_PresidentAndCoo_Name" runat="server" Width="35%"></asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_PresidentAndCOOSignature" runat="server"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_PresidentAndCOODate" runat="server" ReadOnly="true" Visible="false"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell></asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_PresidentAndCOOComment" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:Button ID="btn_PresidentAndCoo_Approve" Text="Approve" runat="server" OnClick="btn_PresidentAndCoo_Approve_Click" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:Label runat="server" ID="lbl_HR" Text="Human Resources :"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:DropDownList ID="drpdwnlst_HR_Name" runat="server" Width="35%"></asp:DropDownList>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_HRSignature" runat="server"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_HRDate" runat="server" ReadOnly="true" Visible="false"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell></asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txt_HRComment" runat="server" TextMode="MultiLine" Width="100%"></asp:TextBox>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:Button ID="btn_HR_Approve" Text="Approve" runat="server" OnClick="btn_HR_Approve_Click" />
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

要求是,根据下拉选择,我想更改表tbl_Approvals的 TableRow 的位置。

如何实现这一点,因为我不能在<asp:Table>内部使用<div>.

根据下拉列表选择动态设置 asp:TableRow 位置

如果是

我,我会创建我想要的不同样式作为CSS类,然后当下拉列表的索引更改时,使用以下方法更改表(或有意义的行)的class属性:

 [object id].Attributes.Add("style", "someCssClass;");