Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


removing a buttoncolumn from a datagrid at Page_load determined by an if statement

Posted on 2006-11-13
Medium Priority
Last Modified: 2013-11-13
I want to remove the columns for "edit" and "delete" from my datagrid if a condition exist during the page_load using c# in
Question by:kwcowboy1226
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

DonKyles earned 2000 total points
ID: 17933652
GridView1.Columns[editColumn].Visible = false;
GridView1.Columns[deleteColumn].Visible = false;  

Author Comment

ID: 17933804
Ok, I used your generic name for editColumn and "Edit" but that column is a buttoncolumn with a updatetext, canceltext, and edittext.  The delete column has a commandname and text.  I used "edit" and "delete" and it didn't work.

Expert Comment

ID: 17933900
editColumn/deleteColumn is the column index number

for example
edit  |  delete  |    ID    |     Name    |        Type          |

the editColumn = 0
and deleteColumn = 1

so the code would be

GridView1.Columns[0].Visible = false;
GridView1.Columns[1].Visible = false;  

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question