dynamic hiding/showing of template column

B

beccak

Hi,
I'm trying to hide a template column in a datagrid then later show it. I've
tried setting the visibility to false, but this doesn't let me get to the
underlying data in the column. I've tried wrapping divs around the data and
setting the div's style to display:none, but this leaves visible empty grid
lines and I can't get the header to show/hide like it should.

Now I'm trying like this:
<style type="text/css">
NowYouSeeIt { Display: block }
NowYouDont { Display: none }
</style>

<asp:TemplateColumn HeaderText="Client ID"
HeaderStyle-CssClass="NowYouDont">
<ItemStyle CssClass="NowYouDont"></ItemStyle>
<ItemTemplate>
<asp:TextBox id="txtItemClientID" runat="server" Width="100px" Text='<%#
DataBinder.Eval(Container, "DataItem.client_id") %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>

And I should be able to do things like this now in the code behind:
dg.Columns(CLIENT_COL_POSITION).ItemStyle.CssClass = "NowYouDo"

Not only does the templated column still display initially even with the
style sheet, but it doesn't respond to attempts to change it in the code
behind.
Anyone know what is going on here?

I've also tried using ItemStyle with the column width, but this doesn't seem
to work either.
Thanks.
 
V

Vidar Petursson

Hi

Spot the difference

<style type="text/css">
..NowYouSeeIt{ Display: block }
..NowYouDont{ Display: none }
</style>

More info
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )

No matter where you go there you are
==============================
 
B

beccak

Thanks for the reply. You're saying leaving out the period causes the whole
thing not to work? I clicked on your link, but it is pretty broad. I have
to admit I normally don't use style sheets. Thanks.
 

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,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top