30

How to get text box values ​​from gridview using jquery

 2 years ago
source link: https://www.codesd.com/item/how-to-get-text-box-values-from-gridview-using-jquery.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to get text box values ​​from gridview using jquery

advertisements

How to textbox values from gridview on click of a linkbutton using jquery here is my gridview

  <asp:GridView ID="gvEmployee" runat="server" AutoGenerateColumns="false" GridLines="Both">
            <Columns>
                <asp:TemplateField HeaderText="Email">
                    <ItemTemplate>
                        <asp:TextBox ID="txtEmail" runat="server" Text='<%#Eval("Emailid") %>'></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Name">
                    <ItemTemplate>
                        <asp:TextBox ID="txtName" runat="server" Text='<%#Eval("Name") %>'></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkgettext" runat="server" Text="Gettextboxvalue"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

I tried something like

  alert($(this).parent("td").parent("tr").find("input:text").val());

I Can able to find first value of a textbox but facing a problem to get next textbox value i.e txtName from second td Please suggest Also suggest if you have any solution with javascript


May this will help you...

    function GVtxtAmount() {
    var GVMaintainReceiptMaster = document.getElementById('<%= GVMaintainReceiptMaster.ClientID %>');

    for (var rowId = 1; rowId < GVMaintainReceiptMaster.rows.length; rowId++) {
        var txtbx = GVMaintainReceiptMaster.rows[rowId].cells[0].children[0];
        alert(txtbx.value);
    }
    return false;
}


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK