V
Vivian
I've created a web page with ASP .NET and C#. Say my aspx filename is
"WebForm1.aspx", I have created another C# file named "Details.cs".
My problem is I want to prompt an alert message from both WebForm1.cs and
Details.cs, WebForm1.cs works fine, but no message can be shown from
Details.cs. The two files are in the same namespace with different class.
I've referred to WebForm1.cs.
The following is my code :
Namespace = "Test"
WebForm1.cs
===========
inside class WebForm1
public void PrintMsg(string key, string msg)
{
this.Page.RegisterClientScriptBlock(key, "<script
type='text/javascript'>alert('" + msg + "');</script>");
}
Details.cs
=======
inside class detailscode
private void PrintMessage(string key, string msg)
{
Test.WebForm1 oForm = new Test.WebForm1();
oForm.PrintMsg(key, msg);
}
"WebForm1.aspx", I have created another C# file named "Details.cs".
My problem is I want to prompt an alert message from both WebForm1.cs and
Details.cs, WebForm1.cs works fine, but no message can be shown from
Details.cs. The two files are in the same namespace with different class.
I've referred to WebForm1.cs.
The following is my code :
Namespace = "Test"
WebForm1.cs
===========
inside class WebForm1
public void PrintMsg(string key, string msg)
{
this.Page.RegisterClientScriptBlock(key, "<script
type='text/javascript'>alert('" + msg + "');</script>");
}
Details.cs
=======
inside class detailscode
private void PrintMessage(string key, string msg)
{
Test.WebForm1 oForm = new Test.WebForm1();
oForm.PrintMsg(key, msg);
}