473,698 Members | 2,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
FileSystemWatch er 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.Forec olor = 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 1497
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 FileSystemWatch er 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
FileSystemWatch er 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.Forec olor = 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 FileSystemWatch er 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 FileSystemWatch er 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 FileSystemWatch er, 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.co m> wrote in message
news:OW******** ******@TK2MSFTN GP12.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
FileSystemWatch er 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.Forec olor = 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 FileSystemWatch er 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.co m> wrote in message
news:OW******** ******@TK2MSFTN GP12.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
FileSystemWatch er 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.Forec olor = 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 FileSystemWatch er.
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.co m> wrote in message
news:eq******** ******@TK2MSFTN GP10.phx.gbl...
Steven,

Putting FileSystemWatch er 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.co m> wrote in message
news:OW******** ******@TK2MSFTN GP12.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
FileSystemWatch er 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.Forec olor = 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.co m> wrote in message
news:uR******** ******@TK2MSFTN GP14.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 FileSystemWatch er.
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.co m> wrote in message
news:eq******** ******@TK2MSFTN GP10.phx.gbl...
Steven,

Putting FileSystemWatch er 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.co m> wrote in message
news:OW******** ******@TK2MSFTN GP12.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
FileSystemWatch er 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.Forec olor = 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.co m> wrote in message
news:uR******** ******@TK2MSFTN GP14.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 FileSystemWatch er.
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.co m> wrote in message
news:eq******** ******@TK2MSFTN GP10.phx.gbl...
Steven,

Putting FileSystemWatch er 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.co m> wrote in message
news:OW******** ******@TK2MSFTN GP12.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
> FileSystemWatch er 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.Forec olor = 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.co m> wrote in message
news:OQ******** *****@TK2MSFTNG P09.phx.gbl...
Steven,

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

Eliyahu

"Steven" <no****@spam.co m> wrote in message
news:uR******** ******@TK2MSFTN GP14.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 FileSystemWatch er.
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.co m> wrote in message
news:eq******** ******@TK2MSFTN GP10.phx.gbl...
Steven,

Putting FileSystemWatch er 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.co m> wrote in message
news:OW******** ******@TK2MSFTN GP12.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
> FileSystemWatch er 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.Forec olor = 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
3691
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example program #include <list>
6
2150
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. could you please have a look at the following script: ------------------------------------------------------------
0
1885
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 have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
18
1502
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 decided to open a new form: ---Code in the click event of a button: button1 if frm is nothing then frm = new form2() frm.show
27
4613
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 = $doc->loadHTMLFile("./aBasicSearchResult.html"); if ( $res == true ) { $zip = $doc->getElementById('zipRaw_id')->value; if ( 0 != $zip ) {
2
5181
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 sends the message "Ping" to the server, which reads it and answers with a "Pong". The game is really simple and the coding should be also very simple! But for me it isn't. By the way, the program uses datagram sockets (UDP). And, I'm using
8
3553
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 simple' problem... I can create a database 'test.db', add a table 'foo' (which BTW I repeatedly DROP on each run) with one INTGER column 'id', and can insert data into with: cur.execute("INSERT INTO foo (id) VALUES (200)") con.commit()
5
1882
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 two jenny 6 0 0 6 6 two jenny 12 0 0 12 12 three jenny 36 36 10.26 36 36
30
3522
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
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.