Hiding GridView Columns without Re-Firing ObjectDataSource Select

G

Guest

Based on wether a row is selected in a GridView I need to HIDE the last two
columns of a gridview. I do NOT need to make the cells invisible I want to
hide the entire column.

When I set the Visible property on the columns it causes the underlying
ObjectDataSource to re-issue the Select statement.

How can I hide these columns without double clutching the ODS Select?
 
S

Steven Cheng[MSFT]

Hi jpondy,

From your description, you want to hide some certain columns in GridView
when a certain Row is selected, correct?

As for the columns, do you mean only the columns belongs to that selected
row or those columns for all the row? Yes, I agree that hiding the column
through Column.Visible is not a good approach. If you just want to hide
those columns for the selected row, you can use RowCreated event and if the
row is the selected one(make the certain columns cell invisible(set the css
style "display" to "none"). If you want the entire column to be
invisible, you can set each column cell(of each row) of that certain column
to invisible(through CSS style). How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top