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

  • Home
  • SEARCH
  • 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 7023641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:44:12+00:00 2026-05-27T23:44:12+00:00

I have a grid view as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False onrowdatabound=dgTask_RowDataBound> <Columns>

  • 0

I have a grid view as under

<asp:GridView ID="dgTask" runat="server" Width="100%" 
            AutoGenerateColumns="False" onrowdatabound="dgTask_RowDataBound">
            <Columns>
                <asp:BoundField DataField="TaskID" HeaderText="TaskID" ItemStyle-Width="1%" />
                <asp:BoundField DataField="TaskName" HeaderText="Task Name" ItemStyle-HorizontalAlign="left"
                    ItemStyle-Width="10%" />
                <asp:BoundField DataField="PriorityName" HeaderText="Priority" ItemStyle-HorizontalAlign="center"
                    ItemStyle-Width="10%" />
                <asp:BoundField DataField="StatusName" HeaderText="Status" ItemStyle-HorizontalAlign="center"
                    ItemStyle-Width="10%" />
                <asp:TemplateField HeaderText="Edit Task" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkBtnEdit" runat="Server" Text="Edit" CommandArgument ='<%# Eval("TaskID") %>' /> 
                        <asp:TextBox ID="txtId" runat="server"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

Now, what I have to do is that on click event of the linkButton, i need to hide the text box controls for that row.

How to do so?

So far I have done as under

protected void dgTask_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton btnEdit = (LinkButton)e.Row.Cells[4].FindControl("lnkBtnEdit");
            btnEdit.Attributes.Add("onclick", "return Test();");
        }
    }

Thanks

  • 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-05-27T23:44:12+00:00Added an answer on May 27, 2026 at 11:44 pm

    You are on the right track, just make minor changes in calling the javascript function and also add the javascript function as below.

    protected void dgTask_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LinkButton btnEdit = (LinkButton)e.Row.Cells[4].FindControl("lnkBtnEdit");
                TextBox txtId = (TextBox)e.Row.Cells[4].FindControl("txtId");
                btnEdit.Attributes.Add("onclick", "return Test("'" + txtId.ClientId + "'");");
            }
        }
    

    And add Javascript like this way,

    function Test(var txtId)
    {
        var inputtxt = document.getElementById(txtId);
        if(inputtxt != null)
        {
            inputtxt.Attributes.Add("style","display:none;");
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Datagrid which looks as under <asp:GridView ID=dgTask runat=server Width=100% AutoGenerateColumns=False> <Columns>
I have this ASP.NET code: <asp:GridView ID=gvImages runat=server AutoGenerateColumns=False CellPadding=4 ForeColor=#333333 GridLines=None> <Columns> <asp:ImageField
I have defined the following in my gridview markup (simplified): <asp:GridView ID=grvReport runat=server DataSourceID=odsReport
I have a grid view like this : <telerik:RadGrid ID=RadGrid1 runat=server GridLines=None AllowPaging=true PageSize=20
I have a asp.net application in that I have grid view and I export
i have gridview in my asp.net web application under framework 3.5. I am binding
I don't have grid view as I am working on asp.net MVC. So can
In gridview's column i have a linkbutton and a label under it. I want
I have grid view with folowing complete code With Msaccess DB.I have used the
I am using vb.net code. I have grid view, please see the code below:

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.