Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get javascript values on code behind in c#
    primarykey
    data
    text
    <p>I need to get javascript values on code behind in c#.I know i can use hidden field but there is no server control on page for postback.Please tell me how can get vales in code behind.</p> <p>Here is my code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Facebook Get Logged in User Details UserName,Email,Profile Image&lt;/title&gt; &lt;script src="jquery-1.6.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; // Load the SDK Asynchronously (function (d) { var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) { return; } js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); } (document)); // Init the SDK upon load window.fbAsyncInit = function () { FB.init({ appId: 'APPID', // App ID channelUrl: '//' + window.location.hostname + '/channel', // Path to your Channel File status: true, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true // parse XFBML }); // listen for and handle auth.statusChange events FB.Event.subscribe('auth.statusChange', function (response) { if (response.authResponse) { // user has auth'd your app and is logged into Facebook var uid = "http://graph.facebook.com/" + response.authResponse.userID + "/picture"; FB.api('/me', function (me) { document.getElementById('auth-displayname').innerHTML = me.name; document.getElementById('myJSString').value = me.name; alert(document.getElementById('myJSString').value); document.getElementById('Email').innerHTML = me.email; document.getElementById('profileImg').src = uid; // document.getElementById('ctl00_CPHDefault_tcTPS_TPProd_ctl01_tcProduction_TPNewT‌​itlesStatus_ChangedRowsIndicesHiddenField').value = uid; // alert('yyy'); }) document.getElementById('auth-loggedout').style.display = 'none'; document.getElementById('auth-loggedin').style.display = 'block'; } else { // user has not auth'd your app, or is not logged into Facebook document.getElementById('auth-loggedout').style.display = 'block'; document.getElementById('auth-loggedin').style.display = 'none'; } }); $("#auth-logoutlink").click(function () { FB.logout(function () { window.location.reload(); }); }); } &lt;/script&gt; &lt;h1&gt; Facebook Login Authentication Example&lt;/h1&gt; &lt;div id="auth-status"&gt; &lt;div id="auth-loggedout"&gt; &lt;div id="Result" class="fb-login-button" autologoutlink="true" scope="email,user_checkins"&gt;Login&lt;/div&gt; &lt;/div&gt; &lt;div id="auth-loggedin" style="display: none"&gt; Name: &lt;b&gt;&lt;span id="auth-displayname"&gt;&lt;/span&gt;&lt;/b&gt;(&lt;a href="#" id="auth-logoutlink"&gt;logout&lt;/a&gt;)&lt;br /&gt; Email: &lt;b&gt;&lt;span id="Email"&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt; Profile Image: &lt;img id="profileImg" /&gt; &lt;form runat="server"&gt; &lt;asp:HiddenField runat="server" id="myJSString" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>You can see there is no server control so how i can get NAME,UID variables in code behind.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload