Making a TemplateColumn invisible

Discussion in 'ASP .Net Web Controls' started by Mombiatch, May 31, 2004.

  1. Mombiatch

    Mombiatch Guest

    Hi

    I've got a class that inherits System.Web.UI.Webcontrols.Table that has the
    option to add a textbox that is not rendered, with the purpose of being able
    to retrieve a field from my view in the postback, without that field ever
    being displayed. In other words, I have the primary key of the record bound
    to a TextBox control on the form, but by adding "display=none" to its Style
    property, the field is not shown on the form. On postback though,
    Page.Request.Form contains a key for the control, and I can then use it to
    update my database. I'm not using a DataAdapter to do the update though -
    hence my need to extract the individual fields, as well as a hidden PK.

    I'm trying to do the same for a class which inherits from DataGrid. All my
    fields are added as TemplateColumns, and I've tried the following to get the
    same effect:

    *Set the TemplateColumn's Visible property to false. This hides the column,
    but then, on postback, it is not present in the Page.Request.Form collection
    *Set the TemplateColumn's EditEtemStyle.Width, HeaderStyle.Width and
    FooterStyle.Width to 0. The column is still displayed though, with the field
    empty, and no data is present in the Page.Request.Form collection.

    Does anyone have any cunning ideas as to how I can achieve this in any other
    way?

    Thanks
    Joe
    Mombiatch, May 31, 2004
    #1
    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. Susan van Houen

    making webcontrols visible/invisible

    Susan van Houen, Jul 13, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    564
    Anatoly
    Jul 13, 2003
  2. Miguel Dias Moura
    Replies:
    1
    Views:
    6,041
  3. SP
    Replies:
    1
    Views:
    943
  4. Andy B
    Replies:
    5
    Views:
    591
    Andy B
    May 29, 2008
  5. rockdale

    Datagrid invisible TemplateColumn dose not generate HTML object?

    rockdale, Jun 6, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    251
    rockdale
    Jun 7, 2006
Loading...

Share This Page