mcrmg
asked on
Calling a function in different page from another page
Hi,
I understand that a class needs to be created in order to do this. But what if there is nothing to return? Say, I just want to have a msg box popup?
thanks
I understand that a class needs to be created in order to do this. But what if there is nothing to return? Say, I just want to have a msg box popup?
thanks
ASKER
I am testing a method. But I am getting error
CS1520: Method must have a return type
CS1520: Method must have a return type
public class test
{
public test1()
{
protected void test_Click(object sender, EventArgs e)
{
System.Windows.Forms.MessageBox.Show("HERE");
}
}
}
are you trying to do this in asp.net? if yes, try this:
web front:
MessageBox is used for window applications
web front:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="test" %>
...
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
code behind:public partial class test : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('HERE')", true);
}
}
MessageBox is used for window applications
ASKER
Sorry for the late reply.
It works. thank you.
What if there are a few function I would like to share across the board? Is there a way to do it? thanks
It works. thank you.
What if there are a few function I would like to share across the board? Is there a way to do it? thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
all depends on what you want to do with your self-defined class.