Change label across pages
<p>I'm working on an application that connects to a serial port. I have experience in C#, but not so much in asp.net.</p>

<p>I have a Label on an aspx page which displays the status of the connection. When I click a button, a new page opens which let's you select the serial port you want to use. When you press the OK button on that page, it will send you back to the original page with the label.</p>

<p>Initially, the label says: "Status: Not connected". I'm saving this string in a globaldata class so I can access the string. I want that when you click the OK button on the new page, it will change the label to "Status: Connected", so when the original page loads the label will be changed.</p>

<p>So in the OK button I added <code>onclick="butOK_Click"</code> and then in the event I change the string in the globaldata class. However, I don't know how to get back to the page. Adding a <code>PostBackUrl="Home/Index"</code> (where Home/Index is the begin page with the label) does return to the begin page, but doesn't execute the code that changes the string.</p>

<p>How can I achieve what I want?</p>

<p>EDIT: now that I think about it, I only want to change the label after executing a function that actually connects to the serial port. I already have this function, it just needs to let the page know that it is connected.</p>
