Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Datagrid invisible TemplateColumn dose not generate HTML object?

Reply
Thread Tools

Datagrid invisible TemplateColumn dose not generate HTML object?

 
 
rockdale
Guest
Posts: n/a
 
      06-06-2006
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
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-07-2006
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" <> wrote in message
news: oups.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
 
 
 
 
rockdale
Guest
Posts: n/a
 
      06-07-2006
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:
> 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" <> wrote in message
> news: oups.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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making 1 control invisible while showing another in the exact location of the invisible one Andy B ASP .Net 5 05-29-2008 03:08 AM
Invisible - Succinic acid : (AMBER ACID) Invisible krithika.143@gmail.com C++ 0 04-14-2008 06:59 PM
Datagrid invisible Label/Textbox does not generate HTML Object? rockdale ASP .Net 3 06-07-2006 01:30 PM
Thread.sleep dose not work from the first time???? al ASP .Net 3 08-03-2004 02:41 PM
Making a TemplateColumn invisible Mombiatch ASP .Net Web Controls 0 05-31-2004 03:00 PM



Advertisments