troubleshooting Question

Updating a control on a different web page

Avatar of Relegence
RelegenceFlag for Israel asked on
Web DevelopmentC#ASP.NET
5 Comments1 Solution228 ViewsLast Modified:
Hello,

I am developing a c# web application. I have 2 web pages.
The first web page has a button which opens a window.
After entering some text in that window and pressing the 'OK' button, I want to update a label in the first web page with the entered text, without causing the first page to postback.

I have tried to call a public function on the opener page but that doesn't work. The control which I need to update is null.

Is there another way to achieve that?

Thank you

The first page is called 'firstPage' and contains a public function:
public void setText(string txt)
{
     lblText.Text = txt;
}
 
The second page has a button_click function from which i want to update the label in the opener page:
protected void btnOK_Click(object sender, EventArgs e)
{
            firstPage page = new firstPage();
            page.setText("Test");
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros