"Hidden" Web Server Control

M

Mike Labosh

I'm a middle tier (dll / MTS / COM+ / Extensions) guy and I'm a bit rusty on
the GUI part of ASP.NET

I have a web form that a user uses to cycle through records in the DB to
review unmatched items and assign / fix them.

I need the WebForm to contain the identity key from the SQL Server table so
the Save button can pass it in a WHERE clause so that the system updates the
correct record, but I don't want the user to SEE this value on the WebForm.

I have tried various combinations of Label / TextBox, Visible=False, and so
forth, and I can't see how to make .NET deliver a <input type=hidden...> to
the browser.

I would REALLY rather not put a Hidden HTML control on the form and have to
do filthy scripting hacks to get the Page_Load to be able to stuff the
primary key of the current record into an HTML control that the server code
can't see.

I also would rather not have to use TextBox Server Controls and then set a
whole bunch of CSS attributes so that border, backcolor and forecolor are
all the same as the background. That's just a dirty kludge to me.
--
Peace & happy computing,

Mike Labosh, MCSD

"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane
 
B

Brock Allen

Page.ClientScript.RegisterHiddenField for ASP.NET 2.0
Page.RegisterHiddenField for ASP.NET 1.1
 
M

Mike Labosh

Page.ClientScript.RegisterHiddenField for ASP.NET 2.0
Page.RegisterHiddenField for ASP.NET 1.1

Perfect! Thanks!

--
Peace & happy computing,

Mike Labosh, MCSD

"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane
 
G

Guest

if you dont wish to use the primary key on the client side

then you can store it in the viewstate of the

like in c#
ViewState["Pkey"]=1;

and retrieve it on postback by

(int)ViewState["Pkey"](if it is a int)

this ensures that your primary key is encrypted and is not visible for
scripting purpose
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,823
Latest member
Nadia88

Latest Threads

Top