Click here to Skip to main content
12,300,878 members (62,024 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0 jQuery
how to get jquery varible value in c# server side?
Posted 17-Sep-12 19:42pm
bhargavpp1.5K
Edited 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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

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

Aspx:
<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.
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100