Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Making a TemplateColumn invisible

Thread Tools

Making a TemplateColumn invisible

Posts: n/a

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


Reply With Quote

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 C++ 0 04-14-2008 06:59 PM
Datagrid invisible TemplateColumn dose not generate HTML object? rockdale ASP .Net Datagrid Control 2 06-07-2006 01:31 PM
Problem with making GridView Visble and Invisible. I am on this for 1 week. Need help. Thank You. Miguel Dias Moura ASP .Net 1 02-22-2006 04:29 PM
making webcontrols visible/invisible Susan van Houen ASP .Net 1 07-13-2003 01:14 PM