C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » HTML »

How to call Html input controls in code behind file?


Posted Date: 13 Jul 2006      Posted By: Kalyan      Member Level: Gold     Points: 2   Responses: 2



Hi,
When I am designing a web page I used some Html input controls(input type text,button etc.) in html view.I have given id,name,value fiels for these controls.And also added runat="server" attribute.Now my doubt is how can we access these controls in code behind file.
For example a button name(id)=btnsubmit.For this i hav given a function name for onclick="function1()" which i wrote in code behind file.But that function is not responsing when the button was clicked.And also when i want to read or assign text for the input type text box,
It is not working.What could be wrong?
Please any one u help to solve this ,as it is urgent.
I am not comfortable with javascript.

Thanks in advance.
Kalyan.





Responses

Author: ankur jain    20 Oct 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 3

Hi,
You can acess input control- text box value say name txt1 in code behind as
string str = txt1.Value;
And for button click in aspx page in <button> tag, write onclick="btn_Click" and use add this method in code behind.



Author: Rams    01 Dec 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 4

Hi Sharon,

After creating the HTML input button write this within the input tag onserverclick="function1" and make the text box as a server control by placing runat="server" and in the code behind add this

protected void function1(object sender, EventArgs e)
{
Text1.Value = "Some Value";
}

Hope this will fulfill your requirement.
-Rams



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.


Next : Help Me Regarding HTML Controls
Previous : How to call Html input controls in code behind file?
Return to Discussion Forum
Post New Message
Category: HTML

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use