Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Comments
Member 11304695 24-Jan-16 9:11am    
asdf

1 solution

got solution just given cssclass to both textboxes as txtclass1 and txtclass2

alert($(this).parent("td").parent("tr").find(".txtclass1").val());
alert($(this).parent("td").parent("tr").find(".txtclass2").val());
 
Share this answer
 
v2

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