在更新面板中将焦点放在gridview中的第一个可编辑列上

大家好,
我使用的是VS 2005、ASP.NET、C#.NET.
我有一个网络应用程序.
我正在使用更新面板中的GRIDVIEW.
我用的是2个GRIDVIEW
如何在GRIDVIEW中将焦点放在第6列?

选择 | 换行 | 行号
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmPLEntryMonthWiseGroupingAllAccHead.aspx.cs" Inherits="frmPLEntryMonthWiseGroupingAllAccHead" %>
  2. <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  3.     Namespace="System.Web.UI" TagPrefix="asp" %>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6.  
  7. <html xmlns="http://www.w3.org/1999/xhtml" >
  8. <head id="Head1" runat="server">
  9. <title>P & L Entry - All Account (Cumulative)</title>
  10. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  11. <link href="includes/text.css" type="text/css" rel="stylesheet" />
  12. <link href="style.css" type="text/css" rel="stylesheet" />
  13. <script type="text/javascript" src="includes/jquery.js">function DIV1_onclick() {
  14.  
  15. }
  16.  
  17. </script>
  18. <style type="text/css"> 
  19. .container {
  20.     width:1200px;
  21.     height:850px;
  22.     overflow:hidden;
  23.     padding:20px;
  24. }
  25. </style> 
  26. <script type="text/javascript" src="includes/plBooking.js"> function isNumberKey() {}</script> 
  27. <script type="text/javascript" src="includes/plBooking.js">function checkBlankPressTab() {}</script>
  28. <script type="text/javascript" src="includes/plBooking.js">function checkBlankPressOnblur() {}</script>
  29. <script type="text/javascript" src="includes/plBooking.js"> function checkValidNo(){}</script>
  30. <script type="text/javascript" src="includes/plBooking.js"> function fnSum(){}</script>
  31. <script type="text/javascript" src="includes/plBooking.js">function fnRound(){}</script> 
  32. <script type="text/javascript" src="includes/plBooking.js"> function isNumberKey1(){}</script>
  33. <script type="text/javascript" src="includes/plBooking.js"> function isNumberKey2(){}</script>
  34. <script type="text/javascript" src="includes/plBooking.js">function appendZero(){    }</script>
  35. <script type="text/javascript" src="includes/plBooking.js"> function validate_Save(){}</script>
  36.  
  37.   <script src="JQuery/jquery-1.4.1.js" type="text/javascript"></script>
  38.  
  39.     <script src="JQuery/jquery.keynavigation.js" type="text/javascript"></script>
  40.  
  41.     <script language="javascript" type="text/javascript">
  42.         $(document).ready(function() {
  43.             //For navigating using left and right arrow of the keyboard
  44.             var gridview = $("#grdView");
  45.             $.keynavigation(gridview);
  46.         });
  47.     </script>
  48.  
  49.  
  50. </head>
  51. <body>
  52. <form id="form1" runat="server">
  53. <div class="container" id="DIV1" onclick="return DIV1_onclick()">
  54.  <asp:ScriptManager id="ScriptManager1" runat="server">
  55.    <Scripts>
  56.             <asp:ScriptReference Path="~/FixFocus.js" />
  57.         </Scripts>
  58.     </asp:ScriptManager> 
  59.  <div>
  60. <asp:Label ID="lblDetails" runat="server" Font-Bold="True" ForeColor="Black" Text="Company Name" Width="1080px"></asp:Label>      
  61. <asp:Label ID="lblExRate" runat="server" Font-Bold="True" ForeColor="Black" Text="Exchange Rate"  ></asp:Label> 
  62.  
  63.  <table width="80" style="height: 480px"  >  
  64. <tr>
  65. <td align="left" colspan="4" valign="top" style="height: 477px; width: 1180px;" ><strong></strong>
  66.  
  67.   <asp:UpdatePanel id="UpdatePanel1" runat="server" ><contenttemplate>
  68. <asp:GridView width="860px" ID="grdView" runat="server"  CssClass="grid" AutoGenerateColumns="False"  DataKeyNames="ahdCode" OnRowDataBound="grdView_RowDataBound" ShowHeader="false" ShowFooter="false"  >
  69. <Columns>
  70. <asp:TemplateField>
  71. <HeaderTemplate>
  72. <asp:Label  ID="lblHead" runat="server" Text="<%# GetHeading() %>"></asp:Label>
  73.  </HeaderTemplate>
  74. <%--<FooterTemplate>
  75.  
  76. </FooterTemplate>--%>
  77. <ItemTemplate>
  78. <table border="0" cellpadding="0" cellspacing="0">
  79. <tr>
  80. <td>
  81.  
  82. <b> <%# DataBinder.Eval(Container.DataItem, "ahdName")%> </b></td>
  83. </tr>
  84. <tr>
  85. <td>
  86.                 <table style="width: 1180px" border="1" cellspacing="0">
  87.                     <tr class="tableHeader">
  88.                         <td style="width: 90px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  89.                             Acc. No
  90.                         </td>
  91.                         <td style="width: 270px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  92.                             P & L Account Name
  93.                         </td>
  94.                         <td style="width: 10px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  95.                             D
  96.                         </td>
  97.                          <td style="width: 10px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  98.                             B
  99.                         </td>                        
  100.                         <td style="width: 10px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  101.                             C
  102.                         </td>
  103.                           <td style="width: 60px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  104.                             <%# fillHeaderCumul() %>
  105.                         </td>
  106.                         <td style="width: 60px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  107.                             <%# fillHeaderBudget() %>
  108.                         </td>
  109.                         <td style="width: 120px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  110.                             P & L As Per Book
  111.                         </td>
  112.                           <td style="width: 80px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  113.                             Adjustments
  114.                         </td>
  115.                         <td style="width: 60px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  116.                             <%# fillHeaderMonthCumul() %>
  117.                         </td>
  118.                         <td style="width: 80px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  119.                             Month Actual
  120.                         </td>
  121.                           <td style="width: 80px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  122.                             Var. in %
  123.                         </td>
  124.                         <td style="width: 280px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
  125.                             Remarks
  126.                         </td>
  127.  
  128.                     </tr>
  129.                 </table>       
  130. <div style=" width:1180px; overflow-x:hide;">
  131.  <asp:Panel runat="server" ID="pnlContainer" ScrollBars="Auto" Height="260px" Width="100%">
  132.     <asp:GridView ID="grdV_Account" runat="server"  Width="98%" CssClass="grid" AutoGenerateColumns="False" ShowHeader="false" ShowFooter="true" OnRowDataBound="grdV_Account_RowDataBound"    >
  133.  
  134.                            <HeaderStyle CssClass="GVFixedHeader" />
  135.                    <FooterStyle CssClass="GVFixedFooter" />                                  
  136.  
  137.                         <Columns>
  138.                             <asp:TemplateField HeaderText="Acc.No." >                                
  139.                                 <ItemStyle Width="70px" />
  140.                                 <ItemTemplate>
  141.                                     <asp:Label ID="lblAccCode" runat="server" Text='<%# Eval("accUserCode") %>'></asp:Label>
  142.                                 </ItemTemplate>
  143.                                 <ControlStyle Width="70px" />
  144.                             </asp:TemplateField>
  145.                             <asp:TemplateField HeaderText="P & L Account Name">                                
  146.                                 <ItemStyle Width="190px" />
  147.                                 <ItemTemplate>
  148.                                     <asp:Label ID="lblAccName" runat="server" Text='<%# Eval("accName") %>'></asp:Label>
  149.                                 </ItemTemplate>
  150.                                  <ControlStyle Width="190px" />
  151.                             </asp:TemplateField>                               
  152.                             <asp:TemplateField HeaderText="D">                                
  153.                                 <ItemStyle Width="10px" />
  154.                                 <ItemTemplate>
  155.                                     <asp:Label ID="lblDeprec" runat="server" ></asp:Label>
  156.                                 </ItemTemplate>
  157.                                  <ControlStyle Width="10px" />
  158.                             </asp:TemplateField>
  159.                             <asp:TemplateField HeaderText="P">                                
  160.                                 <ItemStyle Width="10px" />
  161.                                 <ItemTemplate>
  162.                                     <asp:Label ID="lblProv" runat="server" ></asp:Label>
  163.                                 </ItemTemplate>
  164.                                  <ControlStyle Width="10px" />
  165.                             </asp:TemplateField>
  166.                             <asp:TemplateField HeaderText="C">                                
  167.                                 <ItemStyle Width="10px" />
  168.                                 <ItemTemplate>
  169.                                     <asp:Label ID="lblCons" runat="server" ></asp:Label>
  170.                                 </ItemTemplate>
  171.                                  <ControlStyle Width="10px" />
  172.                             </asp:TemplateField>
  173.  
  174.                             <asp:TemplateField HeaderText="M-1 Cumul.">  
  175.                              <HeaderTemplate>
  176.                                 <asp:Label Width="60px" ID="lblHCumul" runat="server" Text="<%# fillHeaderCumul() %> "></asp:Label>
  177.                             </HeaderTemplate>                                                          
  178.                                 <ItemStyle Width="60px" />
  179.                                 <ItemTemplate>
  180.                                     <asp:TextBox Width="60px" ID="lblPCum" ReadOnly="true" BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("PCum") %>' TabIndex="-1"></asp:TextBox>
  181.                                 </ItemTemplate>
  182.                                 <FooterTemplate>
  183.                                 <asp:Label ID="lblFPCum" runat="server" /> 
  184.                                 </FooterTemplate>                                
  185.                                 <ControlStyle Width="60px" />
  186.                             </asp:TemplateField>
  187.  
  188.                             <asp:TemplateField HeaderText="Budget"> 
  189.                             <HeaderTemplate>
  190.                             <asp:Label Width="60px" ID="lblHBudget" runat="server" Text='<%# fillHeaderBudget() %>'></asp:Label>
  191.                             </HeaderTemplate>                               
  192.                                 <ItemStyle Width="60px" />
  193.                                 <ItemTemplate>
  194.                                     <asp:TextBox Width="60px" ID="lblMBudget"  ReadOnly="true" BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("MBudget") %>' TabIndex="-1"></asp:TextBox>
  195.                                 </ItemTemplate>
  196.                                  <FooterTemplate>
  197.                                 <asp:Label ID="lblFMBudget" runat="server" /> 
  198.                                 </FooterTemplate>
  199.                                 <ControlStyle Width="60px" />
  200.                             </asp:TemplateField>
  201.  
  202.                             <asp:TemplateField HeaderText="P & L As Per Book">
  203.                              <ItemStyle Width="80px" BackColor="white"/>
  204.                             <ItemTemplate>
  205.                             <asp:TextBox Width="80px" ID="txtPL" runat="server" text='<%# Eval("PL") %>'   BorderStyle="None" BorderColor="white"  >
  206.                             </asp:TextBox>
  207.                            </ItemTemplate>
  208.                             <FooterTemplate>
  209.                                 <asp:Label ID="lblFPL" runat="server" /> 
  210.                             </FooterTemplate>
  211.                                 <ControlStyle Width="80px" />
  212.                             </asp:TemplateField>
  213.  
  214.                             <asp:TemplateField HeaderText="Adjustments">
  215.                              <ItemStyle Width="80px" BackColor="white"/>
  216.                             <ItemTemplate>
  217.                             <asp:TextBox Width="80px" ID="txtCorrection" runat="server" text='<%# Eval("Correction") %>'   BorderStyle="None" BorderColor="white" >
  218.                             </asp:TextBox>
  219.                            </ItemTemplate>  
  220.                             <FooterTemplate>
  221.                                 <asp:Label ID="lblFCorrection" runat="server" /> 
  222.                                 </FooterTemplate> 
  223.                            <ControlStyle Width="80px" />                        
  224.                            </asp:TemplateField>
  225.  
  226.                             <asp:TemplateField HeaderText="Cumul."> 
  227.                             <HeaderTemplate>
  228.                                 <asp:Label  Width="60px" ID="lblHMCumul" runat="server" Text="<%# fillHeaderMonthCumul() %> "></asp:Label>
  229.                             </HeaderTemplate>                              
  230.                                 <ItemStyle Width="60px" />
  231.                                 <ItemTemplate>
  232.                                     <asp:TextBox Width="60px" ID="lblMCum"   BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("MCum") %>' TabIndex="-1"></asp:TextBox>
  233.                                 </ItemTemplate>
  234.                                  <FooterTemplate>
  235.                                 <asp:Label ID="lblFMCum" runat="server" /> 
  236.                                 </FooterTemplate>
  237.                                 <ControlStyle Width="60px" />
  238.                             </asp:TemplateField>
  239.  
  240.                             <asp:TemplateField HeaderText="Month Actual">                               
  241.                                 <ControlStyle Width="60px" />
  242.                                 <ItemStyle Width="60px" />
  243.                                 <ItemTemplate>
  244.                                     <asp:TextBox Width="60px" ID="lblDiffAmt"    BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("DAmt") %>' TabIndex="-1"></asp:TextBox>
  245.                                 </ItemTemplate>
  246.                                  <FooterTemplate>
  247.                                 <asp:Label ID="lblFDAmt" runat="server" /> 
  248.                                 </FooterTemplate>
  249.                             </asp:TemplateField>
  250.  
  251.                             <asp:TemplateField HeaderText="Var. In %">                                
  252.                                 <ItemStyle Width="60px" />
  253.                                 <ItemTemplate>
  254.                                     <asp:TextBox Width="60px" ID="lblDiffPcnt" runat="server"   BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" Text='<%# Eval("DPcnt") %>' TabIndex="-1"></asp:TextBox>
  255.                                 </ItemTemplate>
  256.                                 <ControlStyle Width="60px" />
  257.                             </asp:TemplateField>    
  258.  
  259.                             <asp:TemplateField HeaderText="Remarks" >                           
  260.                              <ItemStyle Width="190px" BackColor="white" />
  261.                             <ItemTemplate>
  262.                             <asp:TextBox Width="190px" ID="txtComment" runat="server" text='<%# Eval("Comment") %>' BorderStyle="None" BorderColor="white">
  263.                             </asp:TextBox>
  264.                             <asp:HiddenField ID="HFaccCode" runat="server" Value='<%# Eval("accCode") %>' />
  265.                             <asp:HiddenField ID="HFprovision" runat="server" Value='<%# Eval("provision") %>' />
  266.                             <asp:HiddenField ID="HFdepreciation" runat="server" Value='<%# Eval("depreciation") %>' />
  267.                             <asp:HiddenField ID="HFconsolidation" runat="server" Value='<%# Eval("consolidation") %>' />
  268.                              <asp:HiddenField ID="HFplentryCurrentMonthstatus" runat="server" Value='<%# Eval("plentryCurrentMonthstatus") %>' />
  269.  
  270.  
  271.                            </ItemTemplate>
  272.                             <ControlStyle Width="190px" />
  273.                            </asp:TemplateField>
  274.                             <asp:BoundField DataField="provision" HeaderText="provision" Visible="False" />
  275.                             <asp:BoundField DataField="accCode" HeaderText="provision" Visible="False"  />
  276.                         </Columns>
  277.                     </asp:GridView>
  278.                     </asp:Panel>
  279.                     </div>
  280. </td>
  281. </tr>
  282. </table>
  283. </ItemTemplate>
  284. </asp:TemplateField>
  285.  
  286. </Columns>
  287. </asp:GridView> 
  288. </contenttemplate>
  289. </asp:UpdatePanel>
  290.  
  291.  
  292. <table >
  293.          <tr>
  294.          <td>
  295.          <strong><asp:Label ID="lblName" runat="server" Text="Version : "></asp:Label></strong>
  296.           <asp:TextBox ID="txtVersion" runat="server" CssClass="txt" Width="100px" ReadOnly="true"></asp:TextBox> 
  297.           &nbsp;  &nbsp;  &nbsp;&nbsp;  &nbsp;  &nbsp;
  298.            <strong><asp:Label ID="Label7" runat="server" Text="D -"  ></asp:Label></strong>
  299.               <asp:Label ID="Label8" runat="server" ForeColor="blue" Text="Cash Flow Account" Width="150px" ></asp:Label>
  300.             <strong><asp:Label ID="Label1" runat="server" Text="B -" ></asp:Label></strong>
  301.            <asp:Label ID="Label2" runat="server" ForeColor="blue" Text="Budget Account" Width="150px" ></asp:Label>            
  302.                <strong><asp:Label ID="Label9" runat="server" Text="C -"   ></asp:Label></strong> 
  303.                <asp:Label ID="Label10" runat="server" ForeColor="blue" Text="Consolidation Account" Width="225px" ></asp:Label>
  304.  
  305.          </td>
  306.  
  307.                <td>
  308.                 <asp:Bu

标签: Javascript

添加新评论