In the below code i have grid view in which i have a textbox and a button if i enter a textbox and on leaving textbox it should click the button automatically.Pls help me to do this.

 function js_function() {
            $("#ButtonAdd").trigger("click");
        }


<asp:TemplateField HeaderText="Quantity" ItemStyle-Width="150px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtQuantity"  onkeypress="return isNumberKey(event, false);"    runat="server" Height="20px" Width="150px" onblur="js_function();"   > </asp:TextBox>
                                    </ItemTemplate>                                   
                                </asp:TemplateField>


 <asp:TemplateField HeaderText="Remove" HeaderStyle-VerticalAlign="Top" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                                    <ItemTemplate>

                                        <asp:LinkButton ID="lnkdelete" runat="server" CommandName="Delete" OnClientClick="return confirmDelete()" >Delete</asp:LinkButton>
                                    </ItemTemplate>
                                    <FooterTemplate>                                     
                                            <asp:Button ID="ButtonAdd" runat="server"  class="button" Text="Add New" />                                                            
                                   </FooterTemplate>
                                </asp:TemplateField>

Related posts

Recent Viewed