C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to call Html input controls in code behind file?


Posted Date: 13 Jul 2006      Total Responses: 2

Posted By: Kalyan       Member Level: Gold     Points: 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:     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:     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
You must Sign In to post a response.
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   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use