Hide ButtonColumn of Datagrid

N

nuhura01

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.
 
N

nuhura01

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
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top