When I run this codebehind on page load, none of the labels update, and I
don't get any errors. See if you can figure it out:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Thread RETSThread = new Thread(RETSProcess);
RETSThread.Start();
Thread RSSThread = new Thread(RSSProcess);
RSSThread.Start();
}
void RETSProcess()
{
//Retrieves info from a proprietary Real Estate DB and updates
labels with appropriate information, this also does not work, all of the
labels are left blank
}
void RSSProcess()
{
//Retreives RSS information and populates a table on the page,
that doesn't come up at all now.
}
}

Signature
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com
bruce barker - 12 Sep 2007 01:01 GMT
you need to add a wait (say at prerender or last statement in onload)
for the threads to complete. otherwise the rendered html is sent to the
browser before they complete, and changing the labels has no impact.
-- bruce (sqlwork.com)
> When I run this codebehind on page load, none of the labels update, and I
> don't get any errors. See if you can figure it out:
[quoted text clipped - 24 lines]
>
> }
Luke Davis - 12 Sep 2007 01:05 GMT
I've only been programming in .NET for 3 months, can you give me an example
line of a wait command?
Thanks

Signature
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com
> you need to add a wait (say at prerender or last statement in onload) for
> the threads to complete. otherwise the rendered html is sent to the
[quoted text clipped - 30 lines]
>>
>> }
Lit - 12 Sep 2007 01:09 GMT
Do you have to use threads?
Lit
> I've only been programming in .NET for 3 months, can you give me an
> example line of a wait command?
[quoted text clipped - 35 lines]
>>>
>>> }
Luke Davis - 12 Sep 2007 01:24 GMT
Right now it takes a long time to display the text and I am looking for a
way to cut back on the time, and I'm hoping that starting two threads might
help. They are both web services that I am referencing, instead of waiting
for the RETS connection to complete before starting the RSS connection, I'll
start them at the same time.
> Do you have to use threads?
>
[quoted text clipped - 39 lines]
>>>>
>>>> }
Harshal Pachpande - 12 Sep 2007 01:25 GMT
protected void Page_Load(object sender, EventArgs e)
{
Thread a = new Thread(A);
a.Start();
Thread b = new Thread(B);
b.Start();
}
private void A()
{
this.l1.Text = "l1 text";
}
private void B()
{
this.l2.Text = "l2 text";
}
Above worked for me with ASP.NET 2.0
Can data retrieval be a problem?
- Harshal
> Do you have to use threads?
>
[quoted text clipped - 39 lines]
>>>>
>>>> }
Luke Davis - 12 Sep 2007 01:32 GMT
That's because processing those are quick, calling for information from a
remote server takes a while.

Signature
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com
> protected void Page_Load(object sender, EventArgs e)
> {
[quoted text clipped - 63 lines]
>>>>>
>>>>> }
bruce barker - 12 Sep 2007 01:23 GMT
protected void Page_Load(object sender, EventArgs e)
{
Thread RETSThread = new Thread(RETSProcess);
RETSThread.Start();
Thread RSSThread = new Thread(RSSProcess);
RSSThread.Start();
// wait for threads
RETSThread.Join();
RSSThread.Join();
}
-- bruce (sqlwork.com)
> I've only been programming in .NET for 3 months, can you give me an example
> line of a wait command?
>
> Thanks
Luke Davis - 12 Sep 2007 01:34 GMT
Awesome possom
Worked great
> protected void Page_Load(object sender, EventArgs e)
> {
[quoted text clipped - 17 lines]
>>
>> Thanks