Mr. Newbie
Mr. Newbie

Reputation: 412

How to pass data from .ASPX to .ASPX.CS (C#)?

i'm working in a webform page and i want to pass data from the "Client-Side" (ASPX) a value returned by jquery event to the "code behind" (ASPX.CS).

Thanks.

Upvotes: 0

Views: 4577

Answers (2)

Karina
Karina

Reputation: 71

You can save the value in a hidden field and access to it from the server:

or

Set value of hidden field in a form using jQuery's ".val()" doesn't work

Upvotes: 1

ewitkows
ewitkows

Reputation: 3618

Just set the value to an input field like normal. When the page posts to the code behind, the value will be resident.

Example

HTML Markup:

<asp:Textbox id="myTextbox" runat="server" ClientIDMode="Static"/>

jQuery:

$('#myTextbox').val('myVal');

Again, when the form is posted, the value will be sent..

Upvotes: 0

Related Questions