Datagrid invisible TemplateColumn dose not generate HTML object?

Discussion in 'ASP .Net Datagrid Control' started by rockdale, Jun 6, 2006.

  1. rockdale

    rockdale Guest

    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
     
    rockdale, Jun 6, 2006
    #1
    1. Advertising

  2. 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:...
    > 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
    >
     
    Eliyahu Goldin, Jun 7, 2006
    #2
    1. Advertising

  3. rockdale

    rockdale Guest

    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:...
    > > 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
    > >
     
    rockdale, Jun 7, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. al
    Replies:
    3
    Views:
    2,712
  2. rockdale
    Replies:
    3
    Views:
    5,439
    rockdale
    Jun 7, 2006
  3. =?Utf-8?B?amR1YmV5?=

    Sql server dose not exist or access denied

    =?Utf-8?B?amR1YmV5?=, Aug 8, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    964
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Aug 8, 2006
  4. Andy B
    Replies:
    5
    Views:
    628
    Andy B
    May 29, 2008
  5. Mombiatch

    Making a TemplateColumn invisible

    Mombiatch, May 31, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    134
    Mombiatch
    May 31, 2004
Loading...

Share This Page