Click here to Skip to main content
16,012,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...friend ...
i ma using this JQuery.
and Call to gridview templetfiled using Textbox.

C#
$(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();
                    }
                }
            })
        })
    })


Gridview...
C#
<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" />



Textbox validtion Not fair...

please help me...
Posted
Updated 6-May-13 23:16pm
v2
Comments
RelicV 8-May-13 7:48am    
Textbox validation not fair..? what do u want actually.? better validation..?
Sukanta Dey 9-May-13 2:31am    
Use keyup instead of keydown, keydown has issues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900