473,385 Members | 1,742 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,385 software developers and data experts.

Simple problem

Hello,
First, let me state that I am trying to learn asp.net, so I am a beginner.
Now on to the issue. I have a webform with a single Textbox and a
FileSystemWatcher monitoring a directory for OnCreate events. I am trying
to change the text in response to an OnCreate event. I would like to change
the Forecolor to red, from black. Apparently, this is not as easy to do as
in vb.net. I have tried the direct approach in the OnCreate event;
"Textbox1.Forecolor = Color.Red". This produces no results. I have tried
applying a style to the Textbox, no results. Server.Tranfer to another page
produces a "Object not set to an instance" error. Server.Transfer to the
same page does nothing. What do I need to do to accomplish this simple
task?

Thanks,
Steven
Nov 19 '05 #1
7 1476
Stephen,

From what I can gather from the information you have provided you are
trying to change the background colour of the text box without reloading
the page. Web pages work on a pull technology, it needs to ask for new
information. I'd say you'll have to implement some kind of polling
mechanism where the page gets refreshed every so often.

I'm unfamiliar with the FileSystemWatcher and therefore don't know
whether you are monitoring a directory on the client or server machine?
If it's the client machine then you might be able to do something with
some [java-vb]script.

Regards,
Marcus

Steven wrote:
Hello,
First, let me state that I am trying to learn asp.net, so I am a beginner.
Now on to the issue. I have a webform with a single Textbox and a
FileSystemWatcher monitoring a directory for OnCreate events. I am trying
to change the text in response to an OnCreate event. I would like to change
the Forecolor to red, from black. Apparently, this is not as easy to do as
in vb.net. I have tried the direct approach in the OnCreate event;
"Textbox1.Forecolor = Color.Red". This produces no results. I have tried
applying a style to the Textbox, no results. Server.Tranfer to another page
produces a "Object not set to an instance" error. Server.Transfer to the
same page does nothing. What do I need to do to accomplish this simple
task?

Thanks,
Steven

Nov 19 '05 #2
Hi Steven,

I hope you'll pardon me if I only point you in the right direction.

An ASP.Net app is a client-server app, with HTTP as the transport between
client and server. HTTP is stateless, so the only communication between
client and server is via Requests from the client browser.

You have a FileSystemWatcher on the server, which is monitoring for events.
On the client, you have a disconnected web page and a browser. Can a
disconnected browser receive events on the server? No. So, how DO you
respond to server-side events in the client? Well, now it doesn't seem so
simple, does it?

First of all, the FileSystemWatcher raises an event whenever you tell it to
(OnCreate). This event fires asynchronously on the server. IOW, it can fire
at any time. The only time you can update the client from the server is when
you receive a Request from the client. The Request can come at any time. So,
how do we synchronise the server-side event to the client?

The answer is, we don't. We can't. What we CAN do is to create some
persistent server-side objects that remain across Requests, handle the
OnCreate event from the FileSystemWatcher, and maintains state until a fresh
Request comes in from the client. At that point (Request) we can update the
client.

Next question: How does the client know when to do a PostBack for getting
the update? Again, it doesn't. It can't. It's disconnected. So, what can you
do? You can set up a timing mechanism on the client that refreshes the page
(makes a fresh Request) at intervals. This can be done with JavaScript or a
META Refresh tag on the client.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Steven" <no****@spam.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
Hello,
First, let me state that I am trying to learn asp.net, so I am a
beginner.
Now on to the issue. I have a webform with a single Textbox and a
FileSystemWatcher monitoring a directory for OnCreate events. I am trying
to change the text in response to an OnCreate event. I would like to
change
the Forecolor to red, from black. Apparently, this is not as easy to do
as
in vb.net. I have tried the direct approach in the OnCreate event;
"Textbox1.Forecolor = Color.Red". This produces no results. I have tried
applying a style to the Textbox, no results. Server.Tranfer to another
page
produces a "Object not set to an instance" error. Server.Transfer to the
same page does nothing. What do I need to do to accomplish this simple
task?

Thanks,
Steven

Nov 19 '05 #3
Steven,

Putting FileSystemWatcher on a web form doesn't make much sense. A web form
lives very short time, from the moment when an http request arrives till the
moment when the http response is built and sent to the client. Could be less
than a second. Do you anticipate that your directory event will be fired in
the same time? Probably you need to re-think your design.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
Hello,
First, let me state that I am trying to learn asp.net, so I am a beginner. Now on to the issue. I have a webform with a single Textbox and a
FileSystemWatcher monitoring a directory for OnCreate events. I am trying
to change the text in response to an OnCreate event. I would like to change the Forecolor to red, from black. Apparently, this is not as easy to do as in vb.net. I have tried the direct approach in the OnCreate event;
"Textbox1.Forecolor = Color.Red". This produces no results. I have tried
applying a style to the Textbox, no results. Server.Tranfer to another page produces a "Object not set to an instance" error. Server.Transfer to the
same page does nothing. What do I need to do to accomplish this simple
task?

Thanks,
Steven

Nov 19 '05 #4
First, thank you for your replies. I am building a demo where the user will
stay at the same page until the OnCreate event fires then navigate to
another page, then back to the original page with a new FileSystemWatcher.
The user can control when the OnCreate event is fired. All I am trying to
do is to relay to the user, in some way, that the OnCreate event has
occurred.
I am open to suggestions on how to do this.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eq**************@TK2MSFTNGP10.phx.gbl...
Steven,

Putting FileSystemWatcher on a web form doesn't make much sense. A web form lives very short time, from the moment when an http request arrives till the moment when the http response is built and sent to the client. Could be less than a second. Do you anticipate that your directory event will be fired in the same time? Probably you need to re-think your design.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
Hello,
First, let me state that I am trying to learn asp.net, so I am a

beginner.
Now on to the issue. I have a webform with a single Textbox and a
FileSystemWatcher monitoring a directory for OnCreate events. I am trying to change the text in response to an OnCreate event. I would like to

change
the Forecolor to red, from black. Apparently, this is not as easy to do

as
in vb.net. I have tried the direct approach in the OnCreate event;
"Textbox1.Forecolor = Color.Red". This produces no results. I have tried applying a style to the Textbox, no results. Server.Tranfer to another

page
produces a "Object not set to an instance" error. Server.Transfer to the same page does nothing. What do I need to do to accomplish this simple
task?

Thanks,
Steven


Nov 19 '05 #5
Steven,

Kevin's response is marvelous. Read it slowly and several times.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:uR**************@TK2MSFTNGP14.phx.gbl...
First, thank you for your replies. I am building a demo where the user will stay at the same page until the OnCreate event fires then navigate to
another page, then back to the original page with a new FileSystemWatcher.
The user can control when the OnCreate event is fired. All I am trying to
do is to relay to the user, in some way, that the OnCreate event has
occurred.
I am open to suggestions on how to do this.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eq**************@TK2MSFTNGP10.phx.gbl...
Steven,

Putting FileSystemWatcher on a web form doesn't make much sense. A web

form
lives very short time, from the moment when an http request arrives till

the
moment when the http response is built and sent to the client. Could be

less
than a second. Do you anticipate that your directory event will be fired

in
the same time? Probably you need to re-think your design.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
Hello,
First, let me state that I am trying to learn asp.net, so I am a

beginner.
Now on to the issue. I have a webform with a single Textbox and a
FileSystemWatcher monitoring a directory for OnCreate events. I am trying to change the text in response to an OnCreate event. I would like to

change
the Forecolor to red, from black. Apparently, this is not as easy to do
as
in vb.net. I have tried the direct approach in the OnCreate event;
"Textbox1.Forecolor = Color.Red". This produces no results. I have tried applying a style to the Textbox, no results. Server.Tranfer to
another
page
produces a "Object not set to an instance" error. Server.Transfer to

the same page does nothing. What do I need to do to accomplish this

simple task?

Thanks,
Steven



Nov 19 '05 #6
> I am open to suggestions on how to do this.

Well, you already have mine. ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Steven" <no****@spam.com> wrote in message
news:uR**************@TK2MSFTNGP14.phx.gbl...
First, thank you for your replies. I am building a demo where the user
will
stay at the same page until the OnCreate event fires then navigate to
another page, then back to the original page with a new FileSystemWatcher.
The user can control when the OnCreate event is fired. All I am trying to
do is to relay to the user, in some way, that the OnCreate event has
occurred.
I am open to suggestions on how to do this.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eq**************@TK2MSFTNGP10.phx.gbl...
Steven,

Putting FileSystemWatcher on a web form doesn't make much sense. A web

form
lives very short time, from the moment when an http request arrives till

the
moment when the http response is built and sent to the client. Could be

less
than a second. Do you anticipate that your directory event will be fired

in
the same time? Probably you need to re-think your design.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
> Hello,
> First, let me state that I am trying to learn asp.net, so I am a

beginner.
> Now on to the issue. I have a webform with a single Textbox and a
> FileSystemWatcher monitoring a directory for OnCreate events. I am trying > to change the text in response to an OnCreate event. I would like to

change
> the Forecolor to red, from black. Apparently, this is not as easy to
> do

as
> in vb.net. I have tried the direct approach in the OnCreate event;
> "Textbox1.Forecolor = Color.Red". This produces no results. I have tried > applying a style to the Textbox, no results. Server.Tranfer to another

page
> produces a "Object not set to an instance" error. Server.Transfer to the > same page does nothing. What do I need to do to accomplish this simple
> task?
>
> Thanks,
> Steven
>
>



Nov 19 '05 #7
Thanks again. I have looked at the Meta tag and that is what I would like
to do, but only postback once after the OnCreate event occurs. One
requirement is that the user must be able to navigate around an existing asp
and html website, which I have 'hung' the asp.net app from. I am thinking
that asp.net may not the correct technology solution. I'm not sure what
else to use though.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OQ*************@TK2MSFTNGP09.phx.gbl...
Steven,

Kevin's response is marvelous. Read it slowly and several times.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:uR**************@TK2MSFTNGP14.phx.gbl...
First, thank you for your replies. I am building a demo where the user will
stay at the same page until the OnCreate event fires then navigate to
another page, then back to the original page with a new FileSystemWatcher.
The user can control when the OnCreate event is fired. All I am trying to do is to relay to the user, in some way, that the OnCreate event has
occurred.
I am open to suggestions on how to do this.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eq**************@TK2MSFTNGP10.phx.gbl...
Steven,

Putting FileSystemWatcher on a web form doesn't make much sense. A web

form
lives very short time, from the moment when an http request arrives till
the
moment when the http response is built and sent to the client. Could
be less
than a second. Do you anticipate that your directory event will be
fired in
the same time? Probably you need to re-think your design.

Eliyahu

"Steven" <no****@spam.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
> Hello,
> First, let me state that I am trying to learn asp.net, so I am a
beginner.
> Now on to the issue. I have a webform with a single Textbox and a
> FileSystemWatcher monitoring a directory for OnCreate events. I am

trying
> to change the text in response to an OnCreate event. I would like
to change
> the Forecolor to red, from black. Apparently, this is not as easy

to do as
> in vb.net. I have tried the direct approach in the OnCreate event;
> "Textbox1.Forecolor = Color.Red". This produces no results. I have

tried
> applying a style to the Textbox, no results. Server.Tranfer to another page
> produces a "Object not set to an instance" error. Server.Transfer
to the
> same page does nothing. What do I need to do to accomplish this

simple > task?
>
> Thanks,
> Steven
>
>



Nov 19 '05 #8

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

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I donīt know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
18
by: Sender | last post by:
Yesterday there was a very long thread on this query. (You can search on this by post by 'sender' with subject 'Simple Problem' post date Oct 7 time 1:43p) And in the end the following code was...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
2
by: Vitali Gontsharuk | last post by:
Hi! I have a problem programming a simple client-server game, which is called pingpong ;-) The final program will first be started as a server (nr. 2) and then as a client. The client then...
8
by: rdrink | last post by:
I am just getting into pysqlite (with a fair amount of Python and MySQL experience behind me) and have coded a simple test case to try to get the hang of things... yet have run into a 'stock...
5
by: Chelong | last post by:
hey,the follow is the text file content ========================================apple====pear== one Lily 7 0 0 7 7 two Lily 20 20 6.6666 20 8 one Lily 0 10 2.85 4 0 two Lily 22 22 7.33326 2 5 ...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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...
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.