-
HTML Control & Code Behind Module!
Hi,
I am using a hidden input type in my web form. But when I try to access
that variable in code behind module, it seems the module doesnt know about
the variable at all.
The code is like this
In WebForm:
<input type="hidden" id="username">
I am setting a value here on "Onclick" event of a HTML button and then submitting
it to the server.
In CodeModule(C#):
Label1.Text = username.Text
This gives an error. Is it wrong to access HTML control in code behind module???
Could any one please help me!!!
Thanks,
Hari
-
Re: HTML Control & Code Behind Module!
Hi Hari,
"hari" <v_hari@indya.com> wrote in message news:3ca9a513$1@10.1.10.29...
> I am using a hidden input type in my web form. But when I try to access
> that variable in code behind module, it seems the module doesnt know about
> the variable at all.
....
> This gives an error. Is it wrong to access HTML control in code behind
module???
> Could any one please help me!!!
To access the HTML control via code behind, you'll need add runat="server" to
the hidden input:
<input type="hidden" id="username" runat="server">
Also, on the server, I believe you will have to access username.value (not
username.text).
--
Constance Petersen, DevX newsgroup section leader
SoftMedia Artisans, Inc.
http://www.smartisans.com
For useful, usable software and Web sites
Featured Web design: http://www.keweenawnow.com/
--
Please reply in the newsgroup so everyone can benefit
-
Re: HTML Control & Code Behind Module!
> Label1.Text = username.Text
Hari: Alternatively, you can simply retrieve the hidden input field's value
from the Request object, as you would in standard ASP:
<input type="hidden" name="username">
// on server:
Label1.Text = Request("username")
---
Phil Weber
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks