Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
I am creating an application using ASP.Net, in which I have an HTML button on aspx page.

<input type="submit" id="btnSubmit"  runat="server" 
      width:80px; height:29px;" />

how to write textbox1._____ extension
I don't want to use asp control button.

Please help.
Posted
Updated 24-Sep-19 22:37pm
Comments
Sergey Alexandrovich Kryukov 2-Jun-15 12:30pm    
There is no such concept, "call an event". What event? What do you want to achieve?
—SA
iamvinod34 2-Jun-15 12:47pm    
html controls are not accessible in code behind asp.net c# code

You can use ASP controls.. I don't know what is hindering you from doing that..

However, Javascript is another option check the link below:
How to call Server side function with JavaScript[^]
 
Share this answer
 
Comments
iamvinod34 2-Jun-15 13:12pm    
for example:
<input type="text" name="Name" id="txtname" width="120" /> this html input control na..ok
this input control shown codebehind... how to write code in c#...in default.aspx.cs?
Abhipal Singh 3-Jun-15 2:18am    
you will not be able to find your html controls in default.aspx.cs.

The only way you can call your default.aspx.cs functions from default.aspx is by using javascript.

Follow the link in the solution. All you need to do is define a javascript function (say foo()) that calls default.aspx.cs function(server side code) and call this javascript function (foo()) on onclick event of your html button.

Your function call will go this way.
html--->foo()--->default.aspx.cs

Basically you are using javascript function as a proxy to call server side code.
Its easy, use javascript to trigger the event using codeblocks

VB
Public Function Calculate()
 'Do Some Stuffs here
End Sub


HTML
<input type="submit" value="Execute Action" onclick="exec()" />


JavaScript
<script>
function exec()
{
  var tmp = '<%= Calculate() %>';
}
</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900