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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:40:01+00:00 2026-05-18T02:40:01+00:00

I wanna enable/disable a button found in every row of my grid control. I

  • 0

I wanna enable/disable a button found in every row of my grid control. I am not sure how I can access it through code. I would think it would bein the GridView1 methods…..

  • 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-18T02:40:02+00:00Added an answer on May 18, 2026 at 2:40 am

    You can disable the button (or better yet, the entire editing of a specif cell) by just handling the ShowingEditor event… You can then inspect the values of other columns and then cancel the editing of that cell depending on your wishes. Here goes some code for a sample program that shows you exactly how to do that:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using DevExpress.XtraGrid.Views.Grid;
    using DevExpress.XtraGrid;
    
    namespace GridButtonDisable
    {
    
    public partial class Form1 : Form
    {
        public class MyData
        {
            public int Number { get; set; }
            public bool Even { get { return Number % 2 == 0; } }
        }
    
        public Form1()
        {
            InitializeComponent();
    
            List<MyData> List = new List<MyData>
            {
                new MyData() { Number = 1 },
                new MyData() { Number = 2 },
                new MyData() { Number = 5 },
                new MyData() { Number = 7 },
                new MyData() { Number = 10 },
            };
    
            gridControl1.DataSource = List;
            gridView1.ShowingEditor += gridView1_ShowingEditor;
        }
    
        private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
        {
            GridView view = sender as GridView;
            if (view.FocusedColumn.Name == "gridButtonCol" && 
                !(bool)view.GetRowCellValue(view.FocusedRowHandle, "Even") )
                e.Cancel = true;
        }
    }
    

    This is a pretty simple program. You must assume your button edit column is named gridButtonCol… I’m testing the value of the Even column of the MyData class I’ve created for this sample, you can do whatever you want and check whichever condition you like here.

    If you set the e.Cancel property of the CancelEventArgs of the ShowingEditor event, the cell won’t be editable and the button editor won’t respond to user clicks…

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

Sidebar

Related Questions

I wanna check radio buttons automatically: I tried this code but it does not
I know how to enable/disable comments on all pages. But how can I enable
I wanna run Chrome on Mac with the parameter --enable-speech-input . Can anyone tell
I wanna run Chrome on Linux with the parameter --enable-speech-input . Can anyone tell
Here is the following form and i wanna access form`s apply button inside the
i wanna do a single selection in my table view here is my code
I wanna call some ASM functions in VB.NET. How can I do it? It's
I wanna send /data/anr/traces.txt if app ever crashed, but the question is how can
I wanna start using Google Analytics PHP API. I found 2 libraries and I
i'm new to joomla and i wanna know how can i install modules(or whatever

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.