Sivajihero Hero

Sivajihero Hero

  • NA
  • 105
  • 32.7k

Textboxe inside gridview not going to next while press enter

Mar 22 2016 4:07 AM
I have a gridview in which template field are there and contain textboxes,dropdowlist in each cell. In my application
I need to go to next cell in gridview while pressing enter. This application is working in internet explorer 10. But its not working in chrome or IE11. While pressing enter it will go from one text box to next but will stop when it reaches the dropdownlist.It only works textboxes inside the gridview.
This is my code for going to next column.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField HeaderText="Slno">
<ItemTemplate>
<asp:TextBox ID="txtSlno" runat="server"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
ReadOnly="false" Text="<%#Container.DataItemIndex+1 %>" Font-Bold="True"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtSlno" runat="server" ReadOnly="false"
Text='<%# Eval("Slno")%>' Font-Bold="True"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSlno" runat="server" ClientIDMode="Static"
ontextchanged="txtSlno_TextChanged" Width="70px" Font-Bold="True" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Code">
<ItemTemplate>
<asp:TextBox ID="txtcode" runat="server" AutoPostBack="False" Text='<%# Eval("Code")%>' onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
onkeyup="javascript:__doPostBack('UpdatePanel1','')"
ontextchanged="txtcode_TextChanged" Width="40" BorderStyle="None" Font-Bold="True" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtcode" runat="server" ontextchanged="txtcode_TextChanged" BorderColor="#333333" BorderWidth="1"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
ReadOnly="false" Text='<%# Eval("Code")%>' Width="40" BorderStyle="None" Font-Bold="True"></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtcode" runat="server" AutoPostBack="False" onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
onkeyup="javascript:__doPostBack('UpdatePanel1','')"
onblur="checkTextField1(this);"
ontextchanged="txtcode_TextChanged" Width="40" BorderStyle="None" Font-Bold="True" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Alt">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList3" runat="server" Height="16px"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;" Font-Bold="True">
<asp:ListItem Text="Y" Value="Y"></asp:ListItem>
<asp:ListItem Text="N" Value="N"></asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="DropDownList3" runat="server"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;" Width="74" Font-Bold="True">
<asp:ListItem Text="Y" Value="Y"></asp:ListItem>
<asp:ListItem Text="N" Value="N"></asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:TextBox ID="TextBox38" runat="server"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
Text='<%# Eval("Alt")%>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Details" ItemStyle-Width="360px">
<ItemTemplate>
<asp:TextBox ID="txtdetails" runat="server"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
Text='<%# Eval("details")%>' Width="100%"
ontextchanged="txtdetails_TextChanged"></asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtdetails" runat="server"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
Text='<%# Eval("details") %>' Width="100%"></asp:TextBox>
</EditItemTemplate>
<ItemStyle Width="360px"/>
<FooterTemplate>
<asp:TextBox ID="txtdetails" runat="server" onblur="checkTextField2(this);"
onkeydown="javascript:if(window.event.keyCode == 13) window.event.keyCode = 9;"
Width="360px"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" OnClick="AddNewCustomer" Text="Add" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Answers (6)