473,382 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Hide ButtonColumn of Datagrid

Hi all..

I have a datagrid in my system and I preview the datagrid in other
html page. Below are the code that I'm using:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(DataGrid1)
DataGrid1.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End

The datagrid that I've created contains a ButtonColumn (Select) in the
first column. The problem is that the above code will preview the
whole datagrid(all columns) while I don't want to preview the first
column. I want to preview the other columns which contains the data.

I don't want to set at the html code:
<asp:ButtonColumn Visible="true" Text="Select" CommandName="Select">
since this may hide the ButtonColumn view at the system. I only to
hide it at the preview page.

Is there any way to do this at the code-behind of the asp.net web
form?Any help is greatly appreciated.

Thanks.

Feb 27 '07 #1
1 2981
On Feb 26, 7:28 pm, nuhur...@yahoo.com wrote:
Hi all..

I have a datagrid in my system and I preview the datagrid in other
html page. Below are the code that I'm using:

Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

Me.ClearControls(DataGrid1)
DataGrid1.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End

The datagrid that I've created contains a ButtonColumn (Select) in the
first column. The problem is that the above code will preview the
whole datagrid(all columns) while I don't want to preview the first
column. I want to preview the other columns which contains the data.

I don't want to set at the html code:
<asp:ButtonColumn Visible="true" Text="Select" CommandName="Select">
since this may hide the ButtonColumn view at the system. I only to
hide it at the preview page.

Is there any way to do this at the code-behind of the asp.net web
form?Any help is greatly appreciated.

Thanks.
I got the solution... ----DataGrid1.Columns(0).Visible = False
Feb 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
by: Steve B. | last post by:
How can I hide a datagrid row or set it's width to zero. I need to filter the grid and and show only rows with selected data. Steve
4
by: Tim | last post by:
Hi, I am trying to hide the datagrid row header (the left most column that has the 'select' triangle in it which moves with the selected row). It seems to be fairly simple;...
1
by: strout | last post by:
Is it possible to add a dropdownlist to pager area so that user can select how many records to display on a page? Thank Strout
2
by: velmj | last post by:
Hi, I have multiple datagrids on my page. I would like to display only one datagrid at a time using a tab buttons. I used a client side javascript function to hide the datagrid which is wrapped...
1
by: Randall Parker | last post by:
Title says it all. Using ASP.Net v1.1. Want to show some message when there are no records to show in a grid. Does one do that with the DataGrid control itself? Or in CodeBehind should one...
1
by: P Dietz | last post by:
Hello, I'm using a datagrid to show data (ok, what else...), and by doubleclick on a row I first hide the Datagrid-Form and start another form to work with the data. After returníng to the...
2
by: glenn | last post by:
Hello, I have a HyperLinkColumn in a DataGrid found in a Summary page. When the link is clicked on, I want to get the data for all fields in the database for that record and display this data...
4
by: wassssup | last post by:
i want to know is there a way to check wherether is there data inside a datagrid and hide the datagrid when there isn't any. for example i drag the datagridview from the toolbox and put it on the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.