Hai All,

Can any one help me how to get html hidden varaible value in asp.net code-behind.

Thanks,
Aswath.

Dani AI

Generated

Good catch by — turning the input into a server-side control fixed the immediate problem for . A few extra points that help avoid surprises in real apps:

Use an ASP.NET HiddenField control when you want strongly-typed access and automatic integration with the page lifecycle and ViewState; its Value is populated by postback processing and is safe to read in Page_Load. If you prefer to keep plain HTML inputs, read the posted value from Request.Form using the input name. Details on the HiddenField control and the Request.Form property are in the official docs: HiddenField class and HttpRequest.Form.

Watch naming-container behavior: master pages, repeaters and user controls change the rendered name/id prefixes. Server controls expose UniqueID (what the form posts) and ClientID (what JavaScript sees); see the ClientID/UniqueID guidance for when to use each: . Finally, never trust client-side hidden values for critical or sensitive data — always validate and enforce on the server or store authoritative state server-side (Session/database). For general input-validation guidance see OWASP’s input-validation resources: .

Recommended Answers

All 2 Replies

add the runat="server" attribute to your html tag and it should show up in the code behind.

Hai,

Thanks for Replay,
I was added runat="server" it is working...........


Thanks,
Aswath.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.