give focus to a first editable column in gridview in update panel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preejo
    New Member
    • Mar 2014
    • 1

    #1

    give focus to a first editable column in gridview in update panel

    Hi All,

    I am using VS 2005,ASP.NET,C# .NET.
    I have a web application.
    I am using gridview in updatepanel.
    I am using 2 gridview in it
    How to give focus to 6 th column in gridview ?
    Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmPLEntryMonthWiseGroupingAllAccHead.aspx.cs" Inherits="frmPLEntryMonthWiseGroupingAllAccHead" %>
    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
    <title>P & L Entry - All Account (Cumulative)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="includes/text.css" type="text/css" rel="stylesheet" />
    <link href="style.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="includes/jquery.js">function DIV1_onclick() {
    
    }
    
    </script>
    <style type="text/css"> 
    .container {
    	width:1200px;
    	height:850px;
    	overflow:hidden;
    	padding:20px;
    }
    </style> 
    <script type="text/javascript" src="includes/plBooking.js"> function isNumberKey() {}</script> 
    <script type="text/javascript" src="includes/plBooking.js">function checkBlankPressTab() {}</script>
    <script type="text/javascript" src="includes/plBooking.js">function checkBlankPressOnblur() {}</script>
    <script type="text/javascript" src="includes/plBooking.js"> function checkValidNo(){}</script>
    <script type="text/javascript" src="includes/plBooking.js"> function fnSum(){}</script>
    <script type="text/javascript" src="includes/plBooking.js">function fnRound(){}</script> 
    <script type="text/javascript" src="includes/plBooking.js"> function isNumberKey1(){}</script>
    <script type="text/javascript" src="includes/plBooking.js"> function isNumberKey2(){}</script>
    <script type="text/javascript" src="includes/plBooking.js">function appendZero(){	}</script>
    <script type="text/javascript" src="includes/plBooking.js"> function validate_Save(){}</script>
    
      <script src="JQuery/jquery-1.4.1.js" type="text/javascript"></script>
    
        <script src="JQuery/jquery.keynavigation.js" type="text/javascript"></script>
    
        <script language="javascript" type="text/javascript">
            $(document).ready(function() {
                //For navigating using left and right arrow of the keyboard
                var gridview = $("#grdView");
                $.keynavigation(gridview);
            });
        </script>
        
        
    </head>
    <body>
    <form id="form1" runat="server">
    <div class="container" id="DIV1" onclick="return DIV1_onclick()">
     <asp:ScriptManager id="ScriptManager1" runat="server">
       <Scripts>
                <asp:ScriptReference Path="~/FixFocus.js" />
            </Scripts>
        </asp:ScriptManager> 
     <div>
    <asp:Label ID="lblDetails" runat="server" Font-Bold="True" ForeColor="Black" Text="Company Name" Width="1080px"></asp:Label>      
    <asp:Label ID="lblExRate" runat="server" Font-Bold="True" ForeColor="Black" Text="Exchange Rate"  ></asp:Label> 
    
     <table width="80" style="height: 480px"  >  
    <tr>
    <td align="left" colspan="4" valign="top" style="height: 477px; width: 1180px;" ><strong></strong>
    
      <asp:UpdatePanel id="UpdatePanel1" runat="server" ><contenttemplate>
    <asp:GridView width="860px" ID="grdView" runat="server"  CssClass="grid" AutoGenerateColumns="False"  DataKeyNames="ahdCode" OnRowDataBound="grdView_RowDataBound" ShowHeader="false" ShowFooter="false"  >
    <Columns>
    <asp:TemplateField>
    <HeaderTemplate>
    <asp:Label  ID="lblHead" runat="server" Text="<%# GetHeading() %>"></asp:Label>
     </HeaderTemplate>
    <%--<FooterTemplate>
    
    </FooterTemplate>--%>
    <ItemTemplate>
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td>
    
    <b> <%# DataBinder.Eval(Container.DataItem, "ahdName")%> </b></td>
    </tr>
    <tr>
    <td>
                    <table style="width: 1180px" border="1" cellspacing="0">
                        <tr class="tableHeader">
                            <td style="width: 90px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                Acc. No
                            </td>
                            <td style="width: 270px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                P & L Account Name
                            </td>
                            <td style="width: 10px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                D
                            </td>
                             <td style="width: 10px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                B
                            </td>                        
                            <td style="width: 10px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                C
                            </td>
                              <td style="width: 60px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                <%# fillHeaderCumul() %>
                            </td>
                            <td style="width: 60px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                <%# fillHeaderBudget() %>
                            </td>
                            <td style="width: 120px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                P & L As Per Book
                            </td>
                              <td style="width: 80px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                Adjustments
                            </td>
                            <td style="width: 60px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                <%# fillHeaderMonthCumul() %>
                            </td>
                            <td style="width: 80px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                Month Actual
                            </td>
                              <td style="width: 80px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                Var. in %
                            </td>
                            <td style="width: 280px; background-color:  whitesmoke; height: 23px; font-weight: bold; font-size: small;text-align:left;color:#1a517f">
                                Remarks
                            </td>
                            
                        </tr>
                    </table>       
    <div style=" width:1180px; overflow-x:hide;">
     <asp:Panel runat="server" ID="pnlContainer" ScrollBars="Auto" Height="260px" Width="100%">
        <asp:GridView ID="grdV_Account" runat="server"  Width="98%" CssClass="grid" AutoGenerateColumns="False" ShowHeader="false" ShowFooter="true" OnRowDataBound="grdV_Account_RowDataBound"    >
    
                               <HeaderStyle CssClass="GVFixedHeader" />
                       <FooterStyle CssClass="GVFixedFooter" />                                  
    
                            <Columns>
                                <asp:TemplateField HeaderText="Acc.No." >                                
                                    <ItemStyle Width="70px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblAccCode" runat="server" Text='<%# Eval("accUserCode") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ControlStyle Width="70px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="P & L Account Name">                                
                                    <ItemStyle Width="190px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblAccName" runat="server" Text='<%# Eval("accName") %>'></asp:Label>
                                    </ItemTemplate>
                                     <ControlStyle Width="190px" />
                                </asp:TemplateField>                               
                                <asp:TemplateField HeaderText="D">                                
                                    <ItemStyle Width="10px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblDeprec" runat="server" ></asp:Label>
                                    </ItemTemplate>
                                     <ControlStyle Width="10px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="P">                                
                                    <ItemStyle Width="10px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblProv" runat="server" ></asp:Label>
                                    </ItemTemplate>
                                     <ControlStyle Width="10px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="C">                                
                                    <ItemStyle Width="10px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblCons" runat="server" ></asp:Label>
                                    </ItemTemplate>
                                     <ControlStyle Width="10px" />
                                </asp:TemplateField>
                               
                                <asp:TemplateField HeaderText="M-1 Cumul.">  
                                 <HeaderTemplate>
                                    <asp:Label Width="60px" ID="lblHCumul" runat="server" Text="<%# fillHeaderCumul() %> "></asp:Label>
                                </HeaderTemplate>                                                          
                                    <ItemStyle Width="60px" />
                                    <ItemTemplate>
                                        <asp:TextBox Width="60px" ID="lblPCum" ReadOnly="true" BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("PCum") %>' TabIndex="-1"></asp:TextBox>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:Label ID="lblFPCum" runat="server" /> 
                                    </FooterTemplate>                                
                                    <ControlStyle Width="60px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Budget"> 
                                <HeaderTemplate>
                                <asp:Label Width="60px" ID="lblHBudget" runat="server" Text='<%# fillHeaderBudget() %>'></asp:Label>
                                </HeaderTemplate>                               
                                    <ItemStyle Width="60px" />
                                    <ItemTemplate>
                                        <asp:TextBox Width="60px" ID="lblMBudget"  ReadOnly="true" BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("MBudget") %>' TabIndex="-1"></asp:TextBox>
                                    </ItemTemplate>
                                     <FooterTemplate>
                                    <asp:Label ID="lblFMBudget" runat="server" /> 
                                    </FooterTemplate>
                                    <ControlStyle Width="60px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="P & L As Per Book">
                                 <ItemStyle Width="80px" BackColor="white"/>
                                <ItemTemplate>
                                <asp:TextBox Width="80px" ID="txtPL" runat="server" text='<%# Eval("PL") %>'   BorderStyle="None" BorderColor="white"  >
                                </asp:TextBox>
                               </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="lblFPL" runat="server" /> 
                                </FooterTemplate>
                                    <ControlStyle Width="80px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Adjustments">
                                 <ItemStyle Width="80px" BackColor="white"/>
                                <ItemTemplate>
                                <asp:TextBox Width="80px" ID="txtCorrection" runat="server" text='<%# Eval("Correction") %>'   BorderStyle="None" BorderColor="white" >
                                </asp:TextBox>
                               </ItemTemplate>  
                                <FooterTemplate>
                                    <asp:Label ID="lblFCorrection" runat="server" /> 
                                    </FooterTemplate> 
                               <ControlStyle Width="80px" />                        
                               </asp:TemplateField>
                             
                                <asp:TemplateField HeaderText="Cumul."> 
                                <HeaderTemplate>
                                    <asp:Label  Width="60px" ID="lblHMCumul" runat="server" Text="<%# fillHeaderMonthCumul() %> "></asp:Label>
                                </HeaderTemplate>                              
                                    <ItemStyle Width="60px" />
                                    <ItemTemplate>
                                        <asp:TextBox Width="60px" ID="lblMCum"   BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("MCum") %>' TabIndex="-1"></asp:TextBox>
                                    </ItemTemplate>
                                     <FooterTemplate>
                                    <asp:Label ID="lblFMCum" runat="server" /> 
                                    </FooterTemplate>
                                    <ControlStyle Width="60px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Month Actual">                               
                                    <ControlStyle Width="60px" />
                                    <ItemStyle Width="60px" />
                                    <ItemTemplate>
                                        <asp:TextBox Width="60px" ID="lblDiffAmt"    BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" runat="server" Text='<%# Eval("DAmt") %>' TabIndex="-1"></asp:TextBox>
                                    </ItemTemplate>
                                     <FooterTemplate>
                                    <asp:Label ID="lblFDAmt" runat="server" /> 
                                    </FooterTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Var. In %">                                
                                    <ItemStyle Width="60px" />
                                    <ItemTemplate>
                                        <asp:TextBox Width="60px" ID="lblDiffPcnt" runat="server"   BorderStyle="none" BorderColor ="honeydew" BackColor="honeydew" Text='<%# Eval("DPcnt") %>' TabIndex="-1"></asp:TextBox>
                                    </ItemTemplate>
                                    <ControlStyle Width="60px" />
                                </asp:TemplateField>    
                                                     
                                <asp:TemplateField HeaderText="Remarks" >                           
                                 <ItemStyle Width="190px" BackColor="white" />
                                <ItemTemplate>
                                <asp:TextBox Width="190px" ID="txtComment" runat="server" text='<%# Eval("Comment") %>' BorderStyle="None" BorderColor="white">
                                </asp:TextBox>
                                <asp:HiddenField ID="HFaccCode" runat="server" Value='<%# Eval("accCode") %>' />
                                <asp:HiddenField ID="HFprovision" runat="server" Value='<%# Eval("provision") %>' />
                                <asp:HiddenField ID="HFdepreciation" runat="server" Value='<%# Eval("depreciation") %>' />
                                <asp:HiddenField ID="HFconsolidation" runat="server" Value='<%# Eval("consolidation") %>' />
                                 <asp:HiddenField ID="HFplentryCurrentMonthstatus" runat="server" Value='<%# Eval("plentryCurrentMonthstatus") %>' />
                                 
                                  
                               </ItemTemplate>
                                <ControlStyle Width="190px" />
                               </asp:TemplateField>
                                <asp:BoundField DataField="provision" HeaderText="provision" Visible="False" />
                                <asp:BoundField DataField="accCode" HeaderText="provision" Visible="False"  />
                            </Columns>
                        </asp:GridView>
                        </asp:Panel>
                        </div>
    </td>
    </tr>
    </table>
    </ItemTemplate>
    </asp:TemplateField>
    
    </Columns>
    </asp:GridView> 
    </contenttemplate>
    </asp:UpdatePanel>
    
     
    <table >
             <tr>
             <td>
             <strong><asp:Label ID="lblName" runat="server" Text="Version : "></asp:Label></strong>
              <asp:TextBox ID="txtVersion" runat="server" CssClass="txt" Width="100px" ReadOnly="true"></asp:TextBox> 
              &nbsp;  &nbsp;  &nbsp;&nbsp;  &nbsp;  &nbsp;
               <strong><asp:Label ID="Label7" runat="server" Text="D -"  ></asp:Label></strong>
                  <asp:Label ID="Label8" runat="server" ForeColor="blue" Text="Cash Flow Account" Width="150px" ></asp:Label>
                <strong><asp:Label ID="Label1" runat="server" Text="B -" ></asp:Label></strong>
               <asp:Label ID="Label2" runat="server" ForeColor="blue" Text="Budget Account" Width="150px" ></asp:Label>            
                   <strong><asp:Label ID="Label9" runat="server" Text="C -"   ></asp:Label></strong> 
                   <asp:Label ID="Label10" runat="server" ForeColor="blue" Text="Consolidation Account" Width="225px" ></asp:Label>
                    
             </td>
             
                   <td>
                    <asp:Button ID="btnShow" runat="server" CssClass="button" OnClick="btnShow_Click"  Text="Show Total" Width="100px" />
                   </td>
                   <td>
                    <asp:Button ID="btnSave" runat="server" CssClass="button" OnClick="btnSave_Click"  Text="Save & Next" Width="100px" />
                    <%--<asp:HiddenField ID = "hdnMnthNumber" runat="server" Visible="true" />--%>
                   </td>
                   <td>
    <%--                <asp:Button ID="btnExit" runat="server" CssClass="button" OnClick="btnExit_Click"   Text="Exit" Width="100px" />
    --%>               </td>
             </tr>
         
          
             <tr>
             
              <td  colspan="4" >
              <strong> <asp:Label ID="Label20" runat="server"  Text="Var. in % - "></asp:Label></strong>
              <asp:Label ID="Label6" runat="server" ForeColor="blue" Text="Difference between Month Actual and Cumul Previous Month." ></asp:Label>
              <asp:Label ID="lblError" runat="server" ForeColor="Red" Text="Error" Width="200px" ></asp:Label>
                   
              </td>
              
             
                                          
             </tr>
             
           
        </table>
        
      
         </td>
         </tr>
         </table>
        </div>
        </div>
        </form>
    </body>
    </html>

    Thanks in advance
    preejo
Working...