Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to get jquery varible value in c# server side?
Posted
Updated 17-Sep-12 20:22pm
v2
Comments
Rajeev Jayaram 18-Sep-12 18:31pm    
Why do you need this? Any specific reason?
bhargavpp 19-Sep-12 1:20am    
yes i have get value from client side using jquery and i want in server side for database insert
Rajeev Jayaram 21-Sep-12 4:51am    
For this requirement there are several ways that you can consider doing, see my answer below.

1 solution

You could store the value in a Hidden Field[^] from jquery and access it via code behind.

Jquery:
JavaScript
$('[id$="HiddenField1"]').val("Your Value");


Aspx:
C#
<asp:hiddenfield id="HiddenField1" runat="server" value="1"/>


(or)

Alternatively you could use Ajax Jquery[^] to call a webservice to perform database insert.

(or)

Use Ajax Page Methods[^].

Hope it helps.
 
Share this answer
 
v2
Comments
bhargavpp 22-Sep-12 5:46am    
this is not working i can't getting any value in server side that is set by client side to hiddenfield
Rajeev Jayaram 24-Sep-12 4:10am    
Are you new to asp.net?
bhargavpp 24-Sep-12 5:54am    
i am not new in .net,we have all data bind from client side means data value is assign to control from Client Side that's way i am asking how to get client side .as per your idea i have tried it but not working.

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