[英]Asp.net GridView Footer Row Textbox Focus Event Jquery
我有一個頁腳行,其中包含 Gridview 中的數量文本框。標記如下:
<asp:GridView ID="gvProdIssue" runat="server" AutoGenerateColumns="False" ShowFooter="True" CssClass="table table-responsive table-hover table-light table-bordered table-sm rounded" DataKeyNames="ID,FromProcessID,ToProcessID,MldID,MachineID,IssEmpID" OnRowCancelingEdit="gvProdIssue_RowCancelingEdit" OnRowCommand="gvProdIssue_RowCommand" OnRowDataBound="gvProdIssue_RowDataBound" OnRowDeleting="gvProdIssue_RowDeleting" OnRowEditing="gvProdIssue_RowEditing" OnRowUpdating="gvProdIssue_RowUpdating" >
<HeaderStyle CssClass="thead-dark" />
<Columns>
<asp:TemplateField HeaderText="Machine">
<EditItemTemplate>
<asp:DropDownList id="ddlEditMachine" runat="server" CssClass="form-control form-control-sm"></asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList id="ddlNewMachine" runat="server" CssClass="myFocus form-control form-control-sm"></asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblMachine" runat="server" Text='<%# Bind("Machine") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Issue Quantity">
<EditItemTemplate>
<asp:TextBox ID="txtEditIssQty" Font-Bold="true" runat="server" CssClass="form-control form-control-sm onlyNum text-lg-right" Text='<%# Bind("IssQty") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewIssQty" runat="server" CssClass="form-control form-control-sm onlyNum" ClientIDMode="Static"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblIssQty" Font-Bold="true" runat="server" Text='<%# Bind("IssQty") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
</columns>
<asp:GridView>
我想要一個 JQuery function ,它在 txtNewIssQty 文本框獲得焦點時調用..如何實現這個>?
enter code here
你可以試試這樣:
$("#txtNewIssQty").click(function(){ //Code you want //Demo Code $("#txtNewIssQty").val("Test"); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div> <input type="text" id="txtNewIssQty"> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.