Here is my gridview
<asp:GridView ID="gvEmployee" runat="server" AutoGenerateColumns="false" GridLines="Both">
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:TextBox ID="txtName" runat="server" Text='<%#Eval("Name") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Emailid" HeaderText="EmailId" />
<asp:TemplateField >
<ItemTemplate>
<asp:LinkButton ID="lnkgettext" runat="server" OnClientClick="return callme(<%= txtName.ClientID %>);" Text="Gettextboxvalue" ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<script type="text/javascript">
function callme(txt) {
alert(txt);
}
</script>
Onclick of LinkButton i want to get the value of a textbox from the current row of gridview
Please help me with javascript
You will have to use row data bound as follows
This can be done by jQuery also. But for this first of all the purpose should be clear.
i.e. Weather you want to postback or not etc
and your gridview as follows
or even jquery function as follow