I am trying to call a C# method from jQuery before the PostBack happens. I've seen some solutions involving Ajax, but I am trying to do this from a UserControl (ascx), so I am not sure that calling a [WebMethod] would work.
Here is the .ascx markup and .cs code for the button and event:
<asp:ImageButton ID="inBottomButton" CssClass="img" title="In Bottom" runat="server" ImageUrl="~/Widgets/QuoteModule/Resources/images/In-Bottom.png" OnClick="inBottomButton_Click" AlternateText="In Bottom"/>
protected void inBottomButton_Click(object sender, ImageClickEventArgs e)
{
QuoteRequest multiQuote = new QuoteRequest { WindPosition = WindPosistions.InBottom };
QuoteResponse quote = ValidateMultiQuoteRequest(multiQuote);
ProcessMultiQuoteRequest(quote);
}
If somebody can help me figure out a way to call the click event from jQuery, I would appreciate it. I know I can prevent the PostBack using (return false;) or preventDefault(e);
And I also know that I can check (IsPostBack) on PageLoad but I am already doing that load data, and that would not help me in this situation.
A user will click the ImageButton (inBottomButton) and generate data that is submitted through the event.
Thanks in advance.
EDIT: Instead of downvoting, can I get a suggestion on how to improve this question?