Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:52:16+00:00 2026-06-14T10:52:16+00:00

Here is my gridview <asp:GridView ID=gvEmployee runat=server AutoGenerateColumns=false GridLines=Both> <Columns> <asp:TemplateField HeaderText=Name> <ItemTemplate> <asp:TextBox

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:52:17+00:00Added an answer on June 14, 2026 at 10:52 am

    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

    protected void gvEmployee_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton lk = (LinkButton)e.Row.FindControl("lnkgettext");
            TextBox textBox = (TextBox)e.Row.FindControl("txtName");
            lk.Attributes.Add("onclick", "return callme('" + lk.ClientID + "')");
        }
    }
    

    and your gridview as follows

    <asp:GridView ID="gvEmployee" runat="server" AutoGenerateColumns="false" GridLines="Both"
            OnRowDataBound="gvEmployee_RowDataBound">
            <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" Text="Gettextboxvalue"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <script type="text/javascript">
            function callme(txt) {
                alert(txt);
            }
        </script>
    

    or even jquery function as follow

         $(document).ready(function () {
            $('#gvEmployee a').click(function () {
                alert($(this).parent("td").parent("tr").find("input:text").val());
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code: <asp:GridView ID=MyGridView runat=server> <Columns> <asp:BoundField Text=Name DataField=Name /> <asp:TemplateField HeaderText=Delete>
Here's what I have (working) : <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=false> <Columns> <asp:BoundField HeaderText=Id DataField=Id
my gridview looks like: <asp:GridView ID=gvFiles runat=server > <Columns> <asp:TemplateField HeaderText=Notification Sent to> <ItemTemplate>
This is my Gridview <asp:GridView ID=GridView2 runat=server AutoGenerateColumns=False Height=191px Width=333px> <Columns> <asp:ImageField HeaderText=Image> </asp:ImageField>
Here is my ASP code: <asp:GridView ID=WagerTable runat=server AutoGenerateColumns=False CssClass=basix > <columns> <asp:BoundField DataField=GameName
I have this ASP.NET code: <asp:GridView ID=gvImages runat=server AutoGenerateColumns=False CellPadding=4 ForeColor=#333333 GridLines=None> <Columns> <asp:ImageField
Here's my aspx: <asp:GridView ID=GVWOReport runat=server DataSourceID=ldsWOReport onprerender=GVWOReport_PreRender GridLines=None CssClass=report > <HeaderStyle CssClass=headerRow />
I have a gridview with the alternatingRowStyle property set. <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False DataSourceID=SqlDataSource2
Hey so I have a gridview as follows <asp:GridView ID=productListTable runat=server DataSourceID=srcProductListPerCustomer AutoGenerateColumns=False AlternatingRowStyle-CssClass=tr_dark
I have a GridView just like this: <asp:GridView ID=gvwStudents runat=server AutoGenerateColumns=False DataKeyNames=ID ShowHeader=False onrowdeleting=gvwStudents_RowDeleting>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.