HighTechTalks DotNet Forums  

Datagrid invisible TemplateColumn dose not generate HTML object?

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Datagrid invisible TemplateColumn dose not generate HTML object? in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
rockdale
 
Posts: n/a

Default Datagrid invisible TemplateColumn dose not generate HTML object? - 06-06-2006 , 04:20 PM






Hi, All:

I have a datagrid with TemplateColumn as following:

<asp:TemplateColumn Visible="False" >
<ItemStyle Width="0px"></ItemStyle>
<ItemTemplate>
<asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this label.
If the Visble is true, on the source code of HTML, I will see <Span id
= blahblah....>. I have a client side javascript to using this label's
value (actually the span's innerText), but the HTML does not have this
<Span object, so I could get the value of this min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object generated.


Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

Thanks a lot
-Rockdale


Reply With Quote
  #2  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Datagrid invisible TemplateColumn dose not generate HTML object? - 06-07-2006 , 04:39 AM






That's right. Asp.Net doesn't generate any html for server controls with
Visible=False. If you need a control on client side, hide it with css rule
display:none.

Eliyahu

"rockdale" <rockdale.green (AT) gmail (DOT) com> wrote

Quote:
Hi, All:

I have a datagrid with TemplateColumn as following:

asp:TemplateColumn Visible="False"
ItemStyle Width="0px"></ItemStyle
ItemTemplate
asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'
/asp:Label
/ItemTemplate
/asp:TemplateColumn

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this label.
If the Visble is true, on the source code of HTML, I will see <Span id
= blahblah....>. I have a client side javascript to using this label's
value (actually the span's innerText), but the HTML does not have this
Span object, so I could get the value of this min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object generated.


Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

Thanks a lot
-Rockdale




Reply With Quote
  #3  
Old   
rockdale
 
Posts: n/a

Default Re: Datagrid invisible TemplateColumn dose not generate HTML object? - 06-07-2006 , 09:31 AM



Brilliant.

I came with
<asp:TemplateColumn ItemStyle-CssClass="invisible"
FooterStyle-CssClass="invisible" HeaderStyle-CssClass="invisible"
ItemStyle-Width=0>

and it works perfect

Thank you very much
-rockdale
Eliyahu Goldin wrote:
Quote:
That's right. Asp.Net doesn't generate any html for server controls with
Visible=False. If you need a control on client side, hide it with css rule
display:none.

Eliyahu

"rockdale" <rockdale.green (AT) gmail (DOT) com> wrote in message
news:1149625247.387903.255860 (AT) c74g2000cwc (DOT) googlegroups.com...
Hi, All:

I have a datagrid with TemplateColumn as following:

asp:TemplateColumn Visible="False"
ItemStyle Width="0px"></ItemStyle
ItemTemplate
asp:Label id="lblMin_Value" Visible=False runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.min_value") %>'
/asp:Label
/ItemTemplate
/asp:TemplateColumn

I set Visible = false for this column because I do not want end user
see this column. But
If I check the html source, I did not see any HTML code for this label.
If the Visble is true, on the source code of HTML, I will see <Span id
= blahblah....>. I have a client side javascript to using this label's
value (actually the span's innerText), but the HTML does not have this
Span object, so I could get the value of this min_value.

I also tried to set Visible =FAlse for <ASP:Label , it is the same.
I tried using <ASP:textbox > it is the same, not HTML object generated.


Does anybody have experience on this before? How should I Invisible an
Label/Textbox in datagrid but generate HTML Object so that JavaScript
can access?

Thanks a lot
-Rockdale



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.