473,480 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Should i worrie?

I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this usercontrol on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think so..

I'm looking for the "how it should" way..
Nov 10 '06 #1
6 1014
Maybe if you use the "this" (C#) or "me" (vb) keyword? Then I would asume that it would behave(?)...

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Edwin Knoppert" <ne**@hellobasic.comwrote in message news:45***********************@text.nova.planet.nl ...
I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this usercontrol on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think so..

I'm looking for the "how it should" way..
Nov 10 '06 #2
Indeed!

i just tested two control instances and they remain having unique values.
The example in the help is ok:

public String Text
{
get
{
object o = ViewState["text"];
return (o == null)? String.Empty : (string)o;
}

set
{
ViewState["Text"] = value;
}
}

"Martin Gregersen" <gr*******@webshine.dkschreef in bericht
news:eX**************@TK2MSFTNGP03.phx.gbl...
Maybe if you use the "this" (C#) or "me" (vb) keyword? Then I would asume
that it would behave(?)...

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet.nl ...
I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this usercontrol on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think so..

I'm looking for the "how it should" way..
Nov 10 '06 #3
Ya. It's pretty smart. Always appends the control's id to the property. You
can easily see this by enabling page tracing.

Also, if you write your own custom server control, if you implement
INamingContainer (no methods are required), it'll take care of it for you
too.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet.nl ...
Indeed!

i just tested two control instances and they remain having unique values.
The example in the help is ok:

public String Text
{
get
{
object o = ViewState["text"];
return (o == null)? String.Empty : (string)o;
}

set
{
ViewState["Text"] = value;
}
}

"Martin Gregersen" <gr*******@webshine.dkschreef in bericht
news:eX**************@TK2MSFTNGP03.phx.gbl...
Maybe if you use the "this" (C#) or "me" (vb) keyword? Then I would asume
that it would behave(?)...

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet.nl ...
I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this usercontrol
on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think so..

I'm looking for the "how it should" way..

Nov 10 '06 #4
Ya. It's pretty smart. Always appends the control's id to the property.
Huh?
I just stated that the viewstate values remain unique by itself.
Iow, no need to add unique id's manually.
Or did i misunderstood your post?

The code i use below should imo be sufficient.

Please correct me if i'm wrong.

Thanks,

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netschreef in bericht news:eg**************@TK2MSFTNGP02.phx.gbl...
Ya. It's pretty smart. Always appends the control's id to the property.
You can easily see this by enabling page tracing.

Also, if you write your own custom server control, if you implement
INamingContainer (no methods are required), it'll take care of it for you
too.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet.nl ...
>Indeed!

i just tested two control instances and they remain having unique values.
The example in the help is ok:

public String Text
{
get
{
object o = ViewState["text"];
return (o == null)? String.Empty : (string)o;
}

set
{
ViewState["Text"] = value;
}
}

"Martin Gregersen" <gr*******@webshine.dkschreef in bericht
news:eX**************@TK2MSFTNGP03.phx.gbl...
Maybe if you use the "this" (C#) or "me" (vb) keyword? Then I would asume
that it would behave(?)...

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet.n l...
I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this usercontrol
on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think so..

I'm looking for the "how it should" way..


Nov 13 '06 #5
That's all I was saying...ASP.NET is smart, it takes care of it for you :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45**********************@text.nova.planet.nl. ..
>Ya. It's pretty smart. Always appends the control's id to the property.
Huh?
I just stated that the viewstate values remain unique by itself.
Iow, no need to add unique id's manually.
Or did i misunderstood your post?

The code i use below should imo be sufficient.

Please correct me if i'm wrong.

Thanks,

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netschreef in bericht news:eg**************@TK2MSFTNGP02.phx.gbl...
>Ya. It's pretty smart. Always appends the control's id to the property.
You can easily see this by enabling page tracing.

Also, if you write your own custom server control, if you implement
INamingContainer (no methods are required), it'll take care of it for you
too.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet.n l...
>>Indeed!

i just tested two control instances and they remain having unique
values.
The example in the help is ok:

public String Text
{
get
{
object o = ViewState["text"];
return (o == null)? String.Empty : (string)o;
}

set
{
ViewState["Text"] = value;
}
}

"Martin Gregersen" <gr*******@webshine.dkschreef in bericht
news:eX**************@TK2MSFTNGP03.phx.gbl...
Maybe if you use the "this" (C#) or "me" (vb) keyword? Then I would
asume that it would behave(?)...

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet. nl...
I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this usercontrol
on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think
so..

I'm looking for the "how it should" way..



Nov 13 '06 #6
Thank you :)

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netschreef in bericht news:%2****************@TK2MSFTNGP04.phx.gbl...
That's all I was saying...ASP.NET is smart, it takes care of it for you :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45**********************@text.nova.planet.nl. ..
>>Ya. It's pretty smart. Always appends the control's id to the property.
Huh?
I just stated that the viewstate values remain unique by itself.
Iow, no need to add unique id's manually.
Or did i misunderstood your post?

The code i use below should imo be sufficient.

Please correct me if i'm wrong.

Thanks,

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
netschreef in bericht news:eg**************@TK2MSFTNGP02.phx.gbl...
>>Ya. It's pretty smart. Always appends the control's id to the property.
You can easily see this by enabling page tracing.

Also, if you write your own custom server control, if you implement
INamingContainer (no methods are required), it'll take care of it for
you too.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet. nl...
Indeed!

i just tested two control instances and they remain having unique
values.
The example in the help is ok:

public String Text
{
get
{
object o = ViewState["text"];
return (o == null)? String.Empty : (string)o;
}

set
{
ViewState["Text"] = value;
}
}

"Martin Gregersen" <gr*******@webshine.dkschreef in bericht
news:eX**************@TK2MSFTNGP03.phx.gbl...
Maybe if you use the "this" (C#) or "me" (vb) keyword? Then I would
asume that it would behave(?)...

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45***********************@text.nova.planet .nl...
I read that i should use the viewstate to store properties for a
usercontrol.
But what will happen when i have 2 or more instances of this
usercontrol on
the same webpage?

Is the ViewState able to make unique instances for me, i don't think
so..

I'm looking for the "how it should" way..



Nov 13 '06 #7

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

Similar topics

303
17408
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
3
2183
by: Andy Visniewski | last post by:
Should be easy, but I've been trying to figure this out for about half an hour with no luck. There is a table 'Cybex' which has all the Cybex products we sell, and a table 'Datasheets' which...
36
4071
by: Jack Hughes | last post by:
This argument has come up two or three times lately. We have a web standards document at our company that say "Use valid HTML 4; We don't recommend switching to DIV-based CSS-P for layout just...
12
2333
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
8
1107
by: Chris Mayers | last post by:
I am trying to track a suspected memory leak in an application I'm writing and through repeated simplification of my project, I have found the following which is quite easily replicated should you...
5
1057
by: davidw | last post by:
Last time, I asked a question about if a XPathDocument could be serialized. Actually what I really want to know is how should I do in this case: I have a class that will be serialized. In the...
6
3645
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
64
3306
by: Morgan Cheng | last post by:
Hi All, I was taught that argument valuse is not supposed to be changed in function body. Say, below code is not good. void foo1(int x) { x ++; printf("x+1 = %d\n", x); } It should be...
8
2192
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - When should I use eval? ----------------------------------------------------------------------- The ` eval() `...
0
7033
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,...
0
7027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7071
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...
1
6726
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...
0
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4763
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...
0
4468
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...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
557
muto222
php
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.