473,382 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

ASP.NET Threading (It's not showing up!)

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.
}
}

--
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
Sep 12 '07 #1
8 1201
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)
Luke Davis wrote:
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.
}
}
Sep 12 '07 #2
I've only been programming in .NET for 3 months, can you give me an example
line of a wait command?

Thanks

--
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" <no****@nospam.comwrote in message
news:uO**************@TK2MSFTNGP03.phx.gbl...
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)
Luke Davis wrote:
>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.
}
}

Sep 12 '07 #3
Lit
Do you have to use threads?

Lit

"Luke Davis" <lu**@gorealco.comwrote in message
news:ei**************@TK2MSFTNGP04.phx.gbl...
I've only been programming in .NET for 3 months, can you give me an
example line of a wait command?

Thanks

--
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" <no****@nospam.comwrote in message
news:uO**************@TK2MSFTNGP03.phx.gbl...
>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)
Luke Davis wrote:
>>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.
}
}


Sep 12 '07 #4
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)
Luke Davis wrote:
I've only been programming in .NET for 3 months, can you give me an example
line of a wait command?

Thanks
Sep 12 '07 #5
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

"Lit" <sq**********@hotmail.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Do you have to use threads?

Lit

"Luke Davis" <lu**@gorealco.comwrote in message
news:ei**************@TK2MSFTNGP04.phx.gbl...
>I've only been programming in .NET for 3 months, can you give me an
example line of a wait command?

Thanks

--
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" <no****@nospam.comwrote in message
news:uO**************@TK2MSFTNGP03.phx.gbl...
>>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)
Luke Davis wrote:
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.
}
}


Sep 12 '07 #6
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.
"Lit" <sq**********@hotmail.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Do you have to use threads?

Lit

"Luke Davis" <lu**@gorealco.comwrote in message
news:ei**************@TK2MSFTNGP04.phx.gbl...
>I've only been programming in .NET for 3 months, can you give me an
example line of a wait command?

Thanks

--
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" <no****@nospam.comwrote in message
news:uO**************@TK2MSFTNGP03.phx.gbl...
>>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)
Luke Davis wrote:
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.
}
}



Sep 12 '07 #7
That's because processing those are quick, calling for information from a
remote server takes a while.

--
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

"Harshal Pachpande" <ha***************@hotmail.comwrote in message
news:ug**************@TK2MSFTNGP05.phx.gbl...
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

"Lit" <sq**********@hotmail.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>Do you have to use threads?

Lit

"Luke Davis" <lu**@gorealco.comwrote in message
news:ei**************@TK2MSFTNGP04.phx.gbl...
>>I've only been programming in .NET for 3 months, can you give me an
example line of a wait command?

Thanks

--
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" <no****@nospam.comwrote in message
news:uO**************@TK2MSFTNGP03.phx.gbl...
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)
Luke Davis wrote:
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.
}
>
>
}
>
>


Sep 12 '07 #8
Awesome possom

Worked great

"bruce barker" <no****@nospam.comwrote in message
news:ui*************@TK2MSFTNGP06.phx.gbl...
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)
Luke Davis wrote:
>I've only been programming in .NET for 3 months, can you give me an
example line of a wait command?

Thanks

Sep 12 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven C | last post by:
Hello: I have a C# app that I'm trying to build. I have three projects in the solution, the first of which stores the base object definitions (base form, base textbox, base commandbutton, etc),...
1
by: Rich | last post by:
Hello, I am trying to draw a graph on a form. I can draw the box using drawline, and bars inside the box using drawrectangle, but when I try to draw a line inside the box the inner lines are...
2
by: Anand | last post by:
Hi All, I have a combobox with style as DropDown List. When I set the combobox.selectedIndex = 0, the first value is not showing up in the combobox and it is simply blank. Only if I...
0
by: ikhan | last post by:
Hello, I am using an activex control on my website. It was running fine with framework 1.1, when I try to run it on framework 2.0 it's not showing up. It's not showing any error message, just a...
5
by: sitko | last post by:
Hi, I'm done a little HTML here and there over the years...but nothing professionally. Now I'm working on a project which calls for some simple HTML. Here is my markup, for the life of me I can't...
6
by: painkiller | last post by:
language: vb.net environment: windows forms .net : v1.1 i am having a checkedlistbox control that display document category such as text, image, video, audio etc. these values are coming from...
7
by: =?Utf-8?B?TG91IDYy?= | last post by:
010498007741048 This number pops up in search boxes at intermittent times..I have no idea why it does or how to delete it. Could it be some kind of malware or virus/spyware running in the...
2
by: BaseballGraphs | last post by:
Hello, I am troubleshoot errors with my code, however, it is not showing up in the console log. Can you please take a look and let me know if anything stands out for why this may not be showing up...
2
by: Alexei Prada | last post by:
Hi guys, I'm not really advanced in html or css, and I'm having a problem that is really getting me out of my nerves. So I redesigned my portfolio site with dreamweaver as my main html css editor....
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.