.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to send Javascript value to server side code

Posted By: priya     Posted Date: January 07, 2010    Points:2   Category :ASP.Net
Hi Friends,

How to send Javascript value to server side code? I need to pass the value from Javascript function to Server side method using C# and Javascript in asp.net.

Thanks in advance

Author: Lalij Mer             
Posted Date: January 07, 2010     Points: 5   

here articles of call javascript function from client side to server side using C#.net


Please Check my answer if you help....
Thank You...

Author: Sagar Pardeshi             
Posted Date: February 01, 2010     Points: 5   

use this code ref from ASp.net Form site

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>

<script type="text/javascript">

function ReceiveServerData(arg, context)

function getValues()
var name='john';
CallTheServer(name, '');


<body >
<form id="form1" runat="server">

<input id="btnSubmit" type="button" value="Submit" onclick="getValues();" />


In C# Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default7 : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)

string cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context");
string callbackScript = "function CallTheServer(arg, context) {" + cbReference + "; }";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallTheServer", callbackScript, true);

public string GetCallbackResult()
return "";

public void RaiseCallbackEvent(string eventArgument)
//In this POint U will get Value john in eventArgument


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend