you can however put your variables into hidden input fields then access those input fields from code-behind.
or use ajax
Take a look at my post on ClientCallbacks here : http://forums.asp.net/t/1118172.aspx
Put this in your Page_Load event:
Page.RegisterStartupScript("popup", "<script>alert('Message Saved');</script>")
Modify it to call whatever function you want.
Hope this helps,
I tried to call js function as below in .NET VB code, but it did not work. No error, no response. Page.ClientScript.RegisterStartupScript(Me.GetType(), "myfunc", "alert('aaa');")
Hi,Try this:this.ClientScript.RegisterStartupScript(this.GetType(), "showmessage", "alert('Hello World');", true); //last parameter will add the script tags automatically.Hope this helps. Best Regards,RajaMCAD .Net, MCDBAPlease choose "Mark as Answer" for the post that leads you to a solution
On a page load event you can just use:
btn.Attributes.Add("onclick", "MyFunction()")Please mark anything that helped you out as an answer.
You cannot directly call serverside ASP.NET methods if thats the question.Mike Schellenberger - MCAD
Many thx in advance !!
I hope you meant VB.NET and not vbscript. Check a post of mine over here
Hello All, I'm new to programming and would appreciate some much needed help. I have hit a wall with one of the issues. Basically first the overview and then the nitty gritty details. I am working on .NET Framework 1.1 and using VB.NET. I had an existing ASP.NET grid in a user control which I have replaced using a third party AJAX Grid (Component Art) instead. Implementing the grid was very easy and up until now it has been a pretty smooth ride. However, now I have one column (out of 8 total) which displays a small table when your mouse hovers over it (in the original ASP.NET ...VB.NET
I've been looking for a solution for a while now and haven't been very successful so hopefully someone can help me out here.
Good Morning all,
I have been working with web services/master pages and incremental page updates (from the HDI video). I now wish to extend the code I have by passing a variable to a function. Every way I have tried doesn't seem to work.
The service method is defined as below:
Function GetSomeStuff(ByVal str as String) As String
And the js code is here:
ret = SiteService.GetSomeStuff("", OnCompleteContent, OnTimeOut, OnError);
This is my code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ Import Namespace="System.Web.Services" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat= server>
public string GetName()
return "Hello Word";