Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-13
3
Medium Priority
?
258 Views
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 asp.net.
0
Comment
Question by:kwcowboy1226
  • 2
3 Comments
 
LVL 6

Accepted Solution

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

Author Comment

by:kwcowboy1226
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.
0
 
LVL 6

Expert Comment

by:DonKyles
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;  
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Loops Section Overview

926 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