Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Iam developing a site using jquery mobile.

Iam using HTML5 tags for the design.

I need to fire server side event on cliking on button.

Please help me..

ASP.NET
<input type="submit"  runat="server" id="btnSubmit" value="Submit"  önclick="btnSubmit_Click" />

C#
protected void btnSubmit_Click(object sender, EventArgs e)
  {
    try
    {
      string SelectedValue = drpAdditionalGuests.Value;
      Response.Redirect("SampleRegistration.aspx");
    }
    catch (Exception ex)
    {
    }
}
Posted
Updated 1-Jan-14 23:26pm
v2
Comments
Kornfeld Eliyahu Peter 1-Jan-14 8:17am    
It's a very bad question.
Tell us about your sever side, and more about your client.
How jQuery UI is connected to all this?
nandakishoreroyal 2-Jan-14 4:16am    
Thank you.

Mr Kornfeld Eliyahu Peter,

by using onclick to the button event it is not firing..

and if we go to design and double click method is generating in javascript.

Ineed to access the method in C# code behind page..
Kornfeld Eliyahu Peter 2-Jan-14 4:18am    
It's not make too much sense either.
Try to add your code to the question so we can examine it...
nandakishoreroyal 2-Jan-14 5:21am    
ASPX

<input type="submit" runat="server" id="btnSubmit" value="Submit" önClick="btnSubmit_Click" />


aspx.cs

protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{

string SelectedValue = drpAdditionalGuests.Value;
Response.Redirect("SampleRegistration.aspx");
}
catch (Exception ex)
{
}
}

when clicking on button aspx.cs page is not called.
nandakishoreroyal 2-Jan-14 7:35am    
iam using html5 tags.
I cant use <asp:Button>

1 solution

The problem that you are using a html element - input - in your aspx. For this the onclick is a client side event only...

Use ASP.NET button - for this onclick will translated into a server side event.

ASP.NET
<asp:button runat="server" id="btnSubmit" onclick="btnSubmit_Click" xmlns:asp="#unknown" />
 
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