Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster
Tony John
Facebook
Google+
Twitter
LinkedIn
Online Members
Priya jain
naveensanagasetti
vineet
More...
Join our online
Google+ community
for Bloggers, Content Writers and Webmasters
Forums
»
.NET
»
HTML
»
Help Me Regarding HTML Controls
Posted Date:
12 Jul 2006
Posted By::
umashankar beeraka
Member Level:
Gold
Member Rank:
0
Points
: 2
Responses:
5
hi frnds,
I am having a small doubt regarding the HTML controls. I want to access the HTML controls' value in the code behind file. How will I achieve this.
I will explain the Scenario;
i am creating a web form for user login. for that i took two html text fields. and one asp.net server button control. Now when i enter some values in the two html textboxes and press the button,now i want to retrieve the values of the two html textboxes from the code behind file. how can i achieve this.please guide me to achieve this.
Thanx in Advance
UmaShankar Beeraka
Tweet
Responses
#62857 Author:
Vikas Joshi
Member Level:
Bronze
Member Rank:
0
Date: 12/Jul/2006 Rating:
Points
: 2
Dear Mr. UmaShankar,
To make use of any HTML control into code behind you have to make the following two changes into the Control...
1. Add the runat=server attribute to the control and place the control inside the form tag
2. Add a ID to that control
Now by these two steps you can access the controls the same way you are using the builtin Web Server controls.
Thanks
Vikas Joshi
#62862 Author:
dotnet
Member Level:
Gold
Member Rank:
2233
Date: 13/Jul/2006 Rating:
Points
: 2
hey use
request.form('id of control')
to get the value of textbox
#62864 Author:
dotnet
Member Level:
Gold
Member Rank:
2233
Date: 13/Jul/2006 Rating:
Points
: 2
first of all set runat="server" to control put some id after that
use
request.form("id_of_control").tostring()
#62871 Author:
Vikas Joshi
Member Level:
Bronze
Member Rank:
0
Date: 13/Jul/2006 Rating:
Points
: 2
Hi,
If you require that the control should be a HTML Control then for that you have to do some workaround for that ..
Please follow the following steps :
Add the onClick attribute to the Button Server control.. And then on Click of this Button at Client side Assign these HTML Controls Value into any other filed lets say a Hidden Variable in a Commo or : Seperated way and get this value in the code behind of the page ..through this you can acheive what you want .. means no need to change the Page only add the Client side Click and do the desired on n number of items on the Page...
Hope this solves your problem
Thanks
Vikas Joshi
#308375 Author:
ankur jain
Member Level:
Silver
Member Rank:
0
Date: 20/Oct/2008 Rating:
Points
: 3
Hi UmaShankar,
Firstly put runnat="server" to yor html text fields say txtLogin and textPassword.
On asp button Click event in .cs file acess these values as
string a = txtLogin.Value;
string b= textPassword.Value;
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
What are HTML controls and Server controls
Previous :
How to call Html input controls in code behind file?
Return to Discussion Forum
Post New Message
Category:
Related Messages
How to capture the event rasied by winform UserControl in html page ?
What are HTML controls and Server controls
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
naveensanagase...
(15)
musathik
(8)
malika
(4)
Last 7 Days
baskar
(279)
Asheej T K
(203)
srisunny
(187)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
About Us
Contact Us
Copyright
Privacy Policy
Terms Of Use
Revenue Sharing sites
Advertise
Talk to
Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.