$(function () { $("[id*=grvExam]").each(function (e) { $("[id*=grvExam]input[type=text][id*=txtMark]").keydown(function (e) { if (e.shiftKey || e.ctrlKey || e.altKey) { e.preventDefault(); } else { var key = e.keyCode; if (!((key == 8) || (key == 46) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105) || (key >= 65 && key <= 66))) { e.preventDefault(); } } }) }) })
<asp:GridView ID="grvExam" runat="server" AutoGenerateColumns="False" CellPadding="0" CssClass="GridViewStyle" Width="70%" AllowPaging="True" PageSize="50"> <pagersettings mode="NextPreviousFirstLast" firstpagetext=" First |" lastpagetext=" Last |"> NextPageText=" Next |" PreviousPageText=" Prev |" /> <pagerstyle horizontalalign="Center" /> <footerstyle backcolor="White" forecolor="#000066" /> <rowstyle cssclass="GridViewRowStyle" /> <columns> <asp:TemplateField HeaderText="Mark"> <itemtemplate> <asp:TextBox ID="txtMark" runat="server" Width="40%" AutoPostBack="true" Text='<%# bind("Exam_OutMark") %>' Style="text-transform: uppercase;" OnTextChanged="txtMark_TextChanged"> </itemtemplate> <itemstyle width="15%" horizontalalign="Left" /> <asp:TemplateField HeaderText="ER No"> <itemtemplate> <asp:Label ID="lbl_ER" runat="server" Text='<%# bind("Student_Rollno") %>'> </itemtemplate> <itemstyle width="10%" horizontalalign="Left" /> </columns> <emptydatatemplate> <div class="EmptyRowStyle"> No Record Found.</div> </emptydatatemplate> <SelectedRowStyle CssClass="GridViewSelectedRowStyle" /> <HeaderStyle CssClass="GridViewHeaderStyle" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)