Request.Form not working?

A

Axford

Hello,
On a WebForm (method=post runat=server) I added a
datagrid, label (visible=false) and input type=hidden.
All controls runat=server (label and datagrid server
controls).

In the page_load I change the values of label and hidden
field: they are rendered correct according to View |
Source of the rendered page. After a postback however I
cannot get to Request.Form["Label_ID"] or Request.Form
["Hidden_ID"] (both null), even Request.Form.Count=0.
When looking at Label_ID.Text or Hidden_ID.Value I get
the initial values before rendering.

Can anybody explain?
Thx.
 
A

Axel Dahmen

Have you perhaps set the EnableViewState property to "False" by accident? It
should be true.

BTW, you shouldn't address your controls the way you do. Instead address
their values directly:

Label_ID.Text = "...";
string str = Hidden_ID.Text;

HTH,
Axel Dahmen
 

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
474,077
Messages
2,570,567
Members
47,204
Latest member
abhinav72673

Latest Threads

Top