Making a TemplateColumn invisible

M

Mombiatch

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top