codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Hide Column  sardinka at 19:40 on Thursday, January 06, 2005
 

I am binding the data to datagrind at run time:
.DataSource = GetData()
.DataBind()
How do I hide a column 2 ?

  Re: Hide Column  tgreer at 19:58 on Thursday, January 06, 2005
 

Do you want to hide the column, or the controls within the column? Are you using templates?

If you don't want a column to render, the best way is to remove the column from your datasource.



  Re: Hide Column  sardinka at 20:49 on Thursday, January 06, 2005
 

I need to show sometimes that column. No it is not a template

  Re: Hide Column  tgreer at 21:01 on Thursday, January 06, 2005
 

Can you show any of your code? Even better, can you post a link to the site? I want to see what kind of table structure it creates.

If you don't want to link, then run the page, and do a "view source". Post the table that the datagrid renders.



  Re: Hide Column  sardinka at 15:14 on Friday, January 07, 2005
 

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
With grdSearchResult
.SelectedIndex = -1
.DataSource = GetData()
.DataBind()
End With
End Sub

GetData() - just a dataset


  Re: Hide Column  tgreer at 15:21 on Friday, January 07, 2005
 

I'd like to help, but "Just a DataSet" isn't informative. How many DataTables are in the DataSet? How have they been constructed? Do you have DataViews in the DataSet? How are you creating DataRows and DataColumns?

Also, I need to see the HTML rendered by the DataGrid. This is because there may be a way to hide columns on the client, using JavaScript.

Also, it would be helpful to see the "HTML" view of the aspx page. In Visual Studio, in the Design Window, you have an "HTML" tab. This shows the datagrid control declaration. I'd like to see that.



  Re: Hide Column  sardinka at 16:45 on Friday, January 07, 2005
 

I found. here is hte answer:
Private Sub grdSearchResult_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdSearchResult.ItemDataBound
e.Item.Cells(1).Visible = False

End Sub








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Difference between " " and ` ` in PERL
•  Order by clause giving an error
•  How to connect ASP.Net with MySql
•  Excecution of ASP.net application in LAN
•  Re: setSize and setTitle
•  web publishing problem
•  C++ and Passwording Files
•  Disabling/enabling the textbox of EditCommandColumn based on value
•  Re: Character Arrays


Recent Articles
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net
Creating CSS Buttons


© Copyright codetoad.com 2001-2006