一个GridView 模版列 拆分行实例

来源:互联网 发布:java rar压缩与解压 编辑:程序博客网 时间:2024/06/14 22:31


效果图




<asp:GridView ID="GridView" runat="server" AutoGenerateColumns="False"  DataKeyNames="RECORD_ID,SEQ"                        BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" CellPadding="3"                          EmptyDataText="No data." Font-Size="9pt" HorizontalAlign="Left"                                            Style="left: 34px; top: 240px" Width="98%"                             onrowdatabound="GridView_RowDataBound"                             onrowdeleting="GridView_RowDeleting" >                        <EmptyDataRowStyle BackColor="LightYellow" BorderColor="Black" BorderStyle="Solid"                            BorderWidth="1px" ForeColor="Black" />                        <RowStyle BackColor="LightYellow" ForeColor="Gray" />                                              <AlternatingRowStyle BackColor="White" ForeColor="DimGray" />                         <Columns>                            <asp:TemplateField ShowHeader="False">                                      <ItemTemplate>                                          <asp:LinkButton ID="lnkDel" runat="server" CausesValidation="False" CommandName="Delete"                                              Text="删除" OnClientClick='<%#  "if (!confirm(\"你确定要删除吗?\")) return false;"%>'></asp:LinkButton>                                      </ItemTemplate>                                      <ItemStyle Width="40px" />                            </asp:TemplateField>                                                          <asp:BoundField DataField="RECORD_ID"  Visible="False">                            </asp:BoundField>                                                        <asp:BoundField DataField="SEQ" HeaderText="序号">                                <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" />                                <ItemStyle Width="30px" />                            </asp:BoundField>                                                                                    <asp:BoundField DataField="ZHONGXIN" HeaderText="中心">                                <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" />                                <ItemStyle Width="70px" />                                <HeaderStyle Width="70px" />                            </asp:BoundField>                                                        <asp:BoundField DataField="BUMEN" HeaderText="部门">                                <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" />                                <ItemStyle Width="70px" />                                <HeaderStyle Width="70px" />                            </asp:BoundField>                                                               <asp:BoundField DataField="XINGMING" HeaderText="姓名">                                <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" />                                <ItemStyle Width="70px" />                                <HeaderStyle Width="70px" />                                                            </asp:BoundField>                                    <asp:BoundField DataField="GONGHAO" HeaderText="工号">                                <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" />                                <ItemStyle Width="70px" />                                <HeaderStyle Width="70px" />                                                            </asp:BoundField>                                                                                                                                      <asp:BoundField DataField="GANGWEI" HeaderText="岗位">                                <HeaderStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" />                                <ItemStyle Width="90px" />                                <HeaderStyle Width="90px" />                                                            </asp:BoundField>                                                          <asp:TemplateField HeaderText="">                                <HeaderStyle Wrap="False"  VerticalAlign="Middle" />                                <ItemStyle Width="60px" />                                 <ItemTemplate>                                     <table>                                         <tr>                                             <td style="border-bottom: black 1pt solid;">                                                 <asp:Label ID="lblYdq" runat="server" Text="异动前"></asp:Label>                                             </td>                                         </tr>                                         <tr>                                             <td>                                                 <asp:Label ID="lblYdh" runat="server" Text="异动后"></asp:Label>                                             </td>                                         </tr>                                     </table>                                 </ItemTemplate>                            </asp:TemplateField>                                                            <asp:TemplateField>                                 <ItemStyle Width="40" />                                 <EditItemTemplate>                                     <table>                                         <tr>                                             <td>                                                 <asp:TextBox ID="txt_1" runat="server" Text=''></asp:TextBox>                                             </td>                                         </tr>                                     </table>                                 </EditItemTemplate>                                 <ItemTemplate>                                     <table>                                         <tr>                                             <td style="width:25%" align="center" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblTdold" runat="server" Text='<%# Bind("TONGDAO") %>' CssClass="txt"></asp:Label>                                             </td>                                              <td style="width:25%" align="center" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblCjold" runat="server" Text='<%# Bind("CENGJI") %>' CssClass="txt"></asp:Label>                                             </td>                                              <td style="width:25%" align="center" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblQjold" runat="server" Text='<%# Bind("QUJIAN") %>' CssClass="txt"></asp:Label>                                             </td>                                              <td style="width:25%" align="center" style="border-bottom: black 1pt solid;">                                                <asp:Label ID="lblXdold" runat="server" Text='<%# Bind("XINDANG") %>' CssClass="txt"></asp:Label>                                             </td>                                                                                      </tr>                                         <tr>                                             <td style="width:25%" style="border-right: black 1pt solid;">                                                 <asp:TextBox ID="txtTdNew" runat="server" Text='<%# Bind("TONGDAO") %>' CssClass="txt" Enabled="false"></asp:TextBox>                                             </td>                                             <td style="width:25%" style="border-right: black 1pt solid;">                                                                                                <asp:DropDownList ID="ddl_Cj" runat="server" CssClass="txt"  AutoPostBack="true" OnSelectedIndexChanged="ddl_Cj_SelectedIndexChanged" ></asp:DropDownList>                                                 <asp:HiddenField ID="HidCj" runat="server" Value='<%# Eval("CENGJINEW") %>'/>                                                </td>                                             <td style="width:25%" style="border-right: black 1pt solid;">                                                 <asp:DropDownList ID="ddl_Qj" runat="server" CssClass="txt"  AutoPostBack="true" OnSelectedIndexChanged="ddl_Qj_SelectedIndexChanged"></asp:DropDownList>                                                 <asp:HiddenField ID="HidQj" runat="server" Value='<%# Eval("QUJIANNEW") %>'/>                                                </td>                                             <td style="width:25%">                                                 <asp:DropDownList ID="ddl_Xd" runat="server" CssClass="txt" AutoPostBack="true" OnSelectedIndexChanged="ddl_Xd_SelectedIndexChanged"></asp:DropDownList>                                                 <asp:HiddenField ID="HidXd" runat="server" Value='<%# Eval("XINDANGNEW") %>'/>                                                </td>                                                                                      </tr>                                     </table>                                 </ItemTemplate>                                                                  <HeaderTemplate>                                     <table cellpadding="0" align="left" cellspacing="0" style="width: 100%">                                         <tr>                                             <td align="center" colspan="4" style="border-bottom: black 1pt solid;" >                                                 <asp:Label ID="lblZj" runat="server" Text="职级"></asp:Label>                                             </td>                                                                                      </tr>                                         <tr>                                             <td style="width:25%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblTd" runat="server" Text="通道"></asp:Label>                                             </td>                                             <td style="width:25%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblCj" runat="server" Text="层级"></asp:Label>                                             </td>                                             <td style="width:25%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblQj" runat="server" Text="区间"></asp:Label>                                             </td>                                             <td style="width:25%" align="center">                                                 <asp:Label ID="lblXd" runat="server" Text="薪档"></asp:Label>                                             </td>                                         </tr>                                     </table>                                 </HeaderTemplate>                             </asp:TemplateField>                                                          <asp:TemplateField  >                                 <EditItemTemplate>                                     <table>                                         <tr>                                             <td>                                                 <asp:TextBox ID="txt_2" runat="server" Text=''></asp:TextBox>                                             </td>                                         </tr>                                     </table>                                 </EditItemTemplate>                                 <ItemTemplate>                                     <table>                                         <tr>                                             <td style="width:20%" align="left" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblXcbzold" runat="server" Text='<%# Bind("XCBZ") %>' CssClass="txt"></asp:Label >                                                <asp:Label ID="lblXcbzoldkey" runat="server" Text='<%# Bind("XCBZKEY") %>' Visible="false"></asp:Label >                                             </td>                                              <td style="width:20%" align="left" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblHbold" runat="server" Text='<%# Bind("HB") %>' CssClass="txt"></asp:Label>                                                <asp:Label ID="lblHboldkey" runat="server" Text='<%# Bind("HBKEY") %>'  Visible="false"></asp:Label>                                             </td>                                              <td style="width:20%" align="left" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblCbold" runat="server" Text='<%# Bind("CB") %>' CssClass="txt"></asp:Label>                                                <asp:Label ID="lblCboldkey" runat="server" Text='<%# Bind("CBKEY") %>' Visible="false"></asp:Label>                                             </td>                                              <td style="width:20%" align="left" style="border-bottom: black 1pt solid;border-right: black 1pt solid;">                                                <asp:Label ID="lblGwold" runat="server" Text='<%# Bind("GWBT") %>' CssClass="txt"></asp:Label>                                                <asp:Label ID="lblGwoldkey" runat="server" Text='<%# Bind("GWBTKEY") %>' Visible="false"></asp:Label>                                             </td>                                              <td style="width:20%" align="left" style="border-bottom: black 1pt solid;">                                                <asp:Label ID="lblQtold" runat="server" Text='<%# Bind("QTBT") %>' CssClass="txt"></asp:Label>                                                <asp:Label ID="lblQtoldkey" runat="server" Text='<%# Bind("QTBTKEY") %>' Visible="false"></asp:Label>                                             </td>                                                                                                                                   </tr>                                         <tr>                                             <td style="width:20%" style="border-right: black 1pt solid;">                                                 <asp:TextBox ID="txtXcbznew" runat="server" Text='<%# Bind("XCBZNEW") %>' CssClass="txt" MaxLength="30"                                                  onkeypress="javascript:NumDotInputOnly(this);" onblur="javascript:txtObj_Onblur(this)"                                                 onpaste="return !clipboardData.getData('text').match(/[^\d\.]/g,'')" ondragenter="value=value.replace(/[^\d\.]/g,'')">                                                 </asp:TextBox>                                             </td>                                             <td style="width:20%" style="border-right: black 1pt solid;">                                                 <asp:TextBox ID="txtHbnew" runat="server" Text='<%# Bind("HBNEW") %>' CssClass="txt" MaxLength="30"                                                 onkeypress="javascript:NumDotInputOnly(this);" onblur="javascript:txtObj_Onblur(this)"                                                 onpaste="return !clipboardData.getData('text').match(/[^\d\.]/g,'')" ondragenter="value=value.replace(/[^\d\.]/g,'')"></asp:TextBox>                                             </td>                                             <td style="width:20%" style="border-right: black 1pt solid;">                                                 <asp:TextBox ID="txtCbnew" runat="server" Text='<%# Bind("CBNEW") %>' CssClass="txt" MaxLength="30"                                                 onkeypress="javascript:NumDotInputOnly(this);" onblur="javascript:txtObj_Onblur(this)"                                                 onpaste="return !clipboardData.getData('text').match(/[^\d\.]/g,'')" ondragenter="value=value.replace(/[^\d\.]/g,'')"></asp:TextBox>                                             </td>                                             <td style="width:20%" style="border-right: black 1pt solid;">                                                 <asp:TextBox ID="txtGwnew" runat="server" Text='<%# Bind("GWBTNEW") %>' CssClass="txt" MaxLength="30"                                                 onkeypress="javascript:NumDotInputOnly(this);" onblur="javascript:txtObj_Onblur(this)"                                                 onpaste="return !clipboardData.getData('text').match(/[^\d\.]/g,'')" ondragenter="value=value.replace(/[^\d\.]/g,'')"></asp:TextBox>                                             </td>                                             <td style="width:20%">                                                 <asp:TextBox ID="txtQtnew" runat="server" Text='<%# Bind("QTBTNEW") %>' CssClass="txt" MaxLength="30"                                                 onkeypress="javascript:NumDotInputOnly(this);" onblur="javascript:txtObj_Onblur(this)"                                                 onpaste="return !clipboardData.getData('text').match(/[^\d\.]/g,'')" ondragenter="value=value.replace(/[^\d\.]/g,'')"></asp:TextBox>                                             </td>                                                                            </tr>                                     </table>                                 </ItemTemplate>                                                                  <HeaderTemplate>                                     <table cellpadding="0" align="left" cellspacing="0" style="width: 100%">                                         <tr>                                             <td align="center" colspan="5" style="border-bottom: black 1pt solid;" >                                                 <asp:Label ID="lblGzbz" runat="server" Text="工资标准"></asp:Label>                                             </td>                                                                                      </tr>                                         <tr>                                             <td style="width:20%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblXcbz" runat="server" Text="薪酬标准"></asp:Label>                                             </td>                                             <td style="width:20%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblHb" runat="server" Text="话补"></asp:Label>                                             </td>                                             <td style="width:20%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblCb" runat="server" Text="车补"></asp:Label>                                             </td>                                             <td style="width:20%" align="center" style="border-right: black 1pt solid;">                                                 <asp:Label ID="lblGwbt" runat="server" Text="岗位补贴"></asp:Label>                                             </td>                                             <td style="width:20%" align="center">                                                 <asp:Label ID="lblQtbt" runat="server" Text="其他补贴"></asp:Label>                                             </td>                                         </tr>                                     </table>                                 </HeaderTemplate>                             </asp:TemplateField>                                                                                       <asp:TemplateField HeaderText="月薪合计"  >                                 <EditItemTemplate>                                     <table>                                         <tr>                                             <td>                                                 <asp:TextBox ID="txt_3" runat="server" Text=''></asp:TextBox>                                             </td>                                         </tr>                                     </table>                                 </EditItemTemplate>                                 <ItemTemplate>                                     <table>                                         <tr>                                             <td align="left" style="border-bottom: black 1pt solid;" CssClass="txt">                                                 <asp:Label ID="lblhjold" runat="server" Text='<%# Bind("HjOld") %>' CssClass="txt"></asp:Label>                                             </td>                                         </tr>                                         <tr>                                             <td align="left" >                                                 <asp:TextBox ID="txtHjNew" runat="server" Text='<%# Bind("HJNEW") %>' CssClass="txt" MaxLength="30"                                                 onkeypress="javascript:NumDotInputOnly(this);" onblur="javascript:txtHj_Onblur(this)"                                                 onpaste="return !clipboardData.getData('text').match(/[^\d\.]/g,'')" ondragenter="value=value.replace(/[^\d\.]/g,'')"></asp:TextBox>                                             </td>                                                                     </tr>                                     </table>                                 </ItemTemplate>                                                              </asp:TemplateField>                                                          <asp:TemplateField HeaderText="备注">                                    <ItemTemplate>                                        <asp:TextBox ID="txtRemark" runat="server" Text='<%# Bind("Remark") %>' CssClass="txt" TextMode="MultiLine" MaxLength="100"></asp:TextBox>                                    </ItemTemplate>                                    <HeaderStyle Wrap="False" />                             </asp:TemplateField>                         </Columns>                     </asp:GridView>




原创粉丝点击