List Info

Thread: Hiding columns on an auto generated datagrid




Hiding columns on an auto generated datagrid
country flaguser name
United States
2007-03-12 10:53:38
Hi all,
   
  Is there a way to programmatically hide columns in an auto
generated datagrid?
   
  Here is my datagrid:
   
  <aspataGrid
CellPadding="3"
HeaderStyle-BackColor="#006645"
HeaderStyle-CssClass="WhiteHeaderText"
Width="100%"
OnItemDataBound="grdAllLoans_ItemDataBound"
ID="grdAllLoans" Runat="server"> 
</aspataGrid&
gt;
   
  I've tried numerous methods but nothing seems to work and
it looks as though it pertains to the fact that I'm auto
generating my columns.  But I'd prefer to keep the datagrid
the way it is.
   
  Thanks,
  Mark

 
---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor
--------------------~--> 
Great things are happening at Yahoo! Groups.  See the new
email design.
http://us.click.yahoo.com/lOt0.A/hOaOAA/yQLSAA/NhFolB/TM

------------------------------------------------------------
--------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/join

    (Yahoo! ID required)

<*> To change settings via email:
    mailto:AspNetAnyQuestionIsOk-digest@yahoogroups.com 
   
mailto:AspNetAnyQuestionIsOk-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: Hiding columns on an auto generated datagrid
country flaguser name
United States
2007-03-12 11:13:45
I faced the same problem, the problem was resolved only when
I unchecked the
column autogenerate button.

In design it may not look like that but when u run it u will
se ethe
ifference.

Usman




On 12 Mar 2007 09:00:35 -0700, Mark E <meckeard2000yahoo.com> wrote:
>
>   Hi all,
>
> Is there a way to programmatically hide columns in an
auto generated
> datagrid?
>
> Here is my datagrid:
>
> <aspataGrid
CellPadding="3"
HeaderStyle-BackColor="#006645"
> HeaderStyle-CssClass="WhiteHeaderText"
Width="100%"
> OnItemDataBound="grdAllLoans_ItemDataBound"
ID="grdAllLoans" Runat="server">
>
> </aspataGrid&
gt;
>
> I've tried numerous methods but nothing seems to work
and it looks as
> though it pertains to the fact that I'm auto generating
my columns. But I'd
> prefer to keep the datagrid the way it is.
>
> Thanks,
> Mark
>
> ---------------------------------
> Don't be flakey. Get Yahoo! Mail for Mobile and
> always stay connected to friends.
>
> [Non-text portions of this message have been removed]
>
> 
>


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/join

    (Yahoo! ID required)

<*> To change settings via email:
    mailto:AspNetAnyQuestionIsOk-digest@yahoogroups.com 
   
mailto:AspNetAnyQuestionIsOk-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: Hiding columns on an auto generated datagrid
country flaguser name
United States
2007-03-12 15:45:47
there is two way to hide columns in dataGrid when the auto
generat columns is set to be true .
  1- if you know the position of the column after the
dataGrid rendering then you can write the following code :
   
  Private Sub DataGrid1_ItemDataBound(s As Object, e As
DatagridItemEventArgs)
e.Item.Cells(3).Visible = False
End Sub
   
  2- But if you do not know the position in this case you
have to search on the HeaderText of the column and then Hide
it like this :
   
  Dim myCol  As System.Web.UI.WebControls.DataGridColumn
For Each myCol  In myDG.Columns
If myCol  .HeaderText = "column to hide" Then
myCol.Visible = False
Next

I hope it works and helps 
  

Mark E <meckeard2000yahoo.com> wrote:
          Hi all,

Is there a way to programmatically hide columns in an auto
generated datagrid?

Here is my datagrid:

<aspataGrid
CellPadding="3"
HeaderStyle-BackColor="#006645"
HeaderStyle-CssClass="WhiteHeaderText"
Width="100%"
OnItemDataBound="grdAllLoans_ItemDataBound"
ID="grdAllLoans" Runat="server"> 
</aspataGrid&
gt;

I've tried numerous methods but nothing seems to work and it
looks as though it pertains to the fact that I'm auto
generating my columns. But I'd prefer to keep the datagrid
the way it is.

Thanks,
Mark

---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.

[Non-text portions of this message have been removed]



         

 
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo!
Answers users.

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor
--------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/4It09A/fOaOAA/yQLSAA/NhFolB/TM

------------------------------------------------------------
--------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/join

    (Yahoo! ID required)

<*> To change settings via email:
    mailto:AspNetAnyQuestionIsOk-digest@yahoogroups.com 
   
mailto:AspNetAnyQuestionIsOk-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )