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 7062895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:38:57+00:00 2026-05-28T04:38:57+00:00

I have a gridview with text boxs and two LinkButton Up and Down, I

  • 0

I have a gridview with text boxs and two LinkButton Up and Down, I want to make the LinkButton Up and down as Disable, The condition is, Linkbutton Up must be disable for the first row and Linkbutton Down must be disable for the last row.

I am trying to do in onRowDataBound.. But I am unable to do..

foreach (GridViewRow row in GridView1.Rows)
{
  // some code?
}

Please some one tell me how to do that.. with some test exp.

  • 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-28T04:38:57+00:00Added an answer on May 28, 2026 at 4:38 am

    I wouldn’t do it in the OnRowDataBound event, I would disable the controls after the GridView has been bound:

    // Bind
    gv.DataSource = datasource;
    gv.DataBind();
    
    // Disable Up/Down LinkButtons
    if (gv.Rows.Count > 0)
    {
        // With FindControl() if you know the IDs:
        ((LinkButton)gv.Rows[0].Cells[0].FindControl("lb_up").Enabled = false; // Disable up LinkButton 
        ((LinkButton)gv.Rows[gv.Rows.Count - 1].Cells[0].FindControl("lb_down").Enabled = false; // Disable down LinkButton 
    
        // -- OR --
    
        // Directly index the controls, assuming Up is at 0, and Down is at 1:
        ((LinkButton)gv.Rows[0].Cells[0].Controls[0]).Enabled = false; // Disable up LinkButton 
        ((LinkButton)gv.Rows[gv.Rows.Count - 1].Cells[0].Controls[1]).Enabled = false; // Disable down LinkButton 
    }
    

    You could use either the FindControl method or just directly index the controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView and I want to refresh a row (not the whole
Using ASP.NET VB, I have a form with some text boxes and a Gridview.
I have GridView which I can select a row. I then have a button
Have a gridview control which will show X amount of rows. I want to
Greetings, In my current project, I have gridview, search button, text box for search,
I have a gridview (Edit and Delete enabled) that shows a table. A Text
I have a GridView with ItemTemplate and EditTemplate. There is some text boxes in
Overview: I have two text boxes at the top of this form for inputting
I have a GridView and in one of the GridViewColumn s i want to
I have a Gridview that I want to filter. My gridview is in an

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.