| | |
Calling C# function through Javascript in ASP.NET
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
Not directly, no. Server-side functions live server-side, client-side functions live on the client.
In fact, the only way to get ANY server-side code to run, is to submit the form. ASP.NET unrolls the HTTP headers, unpackages the hidden ViewState variable, re-instantiates objects, and then decides what events to raise based on all of the above.
What you can do is have your JavaScript function set a hidden form variable, then do a form.submit().
Then, in your Page_Load handler on the server, use the Request object to check for the presence and/or value of this variable, and call the appropriate server-side method.
In fact, the only way to get ANY server-side code to run, is to submit the form. ASP.NET unrolls the HTTP headers, unpackages the hidden ViewState variable, re-instantiates objects, and then decides what events to raise based on all of the above.
What you can do is have your JavaScript function set a hidden form variable, then do a form.submit().
Then, in your Page_Load handler on the server, use the Request object to check for the presence and/or value of this variable, and call the appropriate server-side method.
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
you can do this.
please visit this article . i thing it would be help full to you.
http://sappidireddy.wordpress.com/20...n-aspnet-ajax/
please visit this article . i thing it would be help full to you.
http://sappidireddy.wordpress.com/20...n-aspnet-ajax/
-1
#8 27 Days Ago
![]() |
Similar Threads
- ASP.NET and JavaScript (ASP.NET)
- How to transfer values between ASP.NET pages (ASP.NET)
- variables from javascript in asp.net (ASP.NET)
- help with asp.net/JS and cookies (ASP.NET)
- Javascript:How to transfer values between ASP.NET pages (JavaScript / DHTML / AJAX)
Other Threads in the ASP.NET Forum
- Previous Thread: Web services in .Net
- Next Thread: Pop up window
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers







