.NET Framework Developer Center >
.NET Development Forums
>
JScript for the .NET Framework
>
Problem Call a Server-side Method From Jscript file
Problem Call a Server-side Method From Jscript file
- Hi;
I called a server-side method from javascript function in page.
<
SelectReportByPageIndex.ReportID=
but while me put this code in jscript file,server-side method was not called.
How can me call a server-side method from jscript file?
Thanks,mohsen
"<%=SetReportID()%>"; </script>script type="text/javascript">
Answers
Hi,
For the questions relating to asp.net ,please post to: http://forums.asp.net/.
Thanks,
Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bymohsendeveloper Wednesday, September 16, 2009 6:08 PM
- I think it will be difficult call server side method directly from javascript.
Because the server side page is executed first and then the javascript is rendered.
So the event anyways need to be processed on the server.
So you have to make a request to server again.
And still if you want to call the server side method please try using ASP.NET callbacks implementation.
- Marked As Answer bymohsendeveloper Tuesday, October 20, 2009 6:27 AM
All Replies
Hi,
For the questions relating to asp.net ,please post to: http://forums.asp.net/.
Thanks,
Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bymohsendeveloper Wednesday, September 16, 2009 6:08 PM
- I think it will be difficult call server side method directly from javascript.
Because the server side page is executed first and then the javascript is rendered.
So the event anyways need to be processed on the server.
So you have to make a request to server again.
And still if you want to call the server side method please try using ASP.NET callbacks implementation.
- Marked As Answer bymohsendeveloper Tuesday, October 20, 2009 6:27 AM
- Use Javascript Page method to call server side method.
- Use _doPostBack to post the data back to do any server side processing
Else go for AJAX. As far as i know, there is no other way. Then again, folks at the ASP.NET foums would be able to help you better.
Ganesh Ranganathan
[Please mark the post as answer if it answers your question]
blog.ganeshzone.net


