By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 938 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Custom Controls

P: n/a
When using a custom control. In order to check and see if values have
changed one has to implement the IPostBackDataCollection interface. The
values returned for the control seem to be simply a string with comma
delimited values.

For example, if I were to render two text boxes. One with the Value Terry
and the Other with the Value 'Burns' I would get the following value

Terry,Burns.

I need this to be more like this

Forname,Terry,Surname,Burns. So I get get this into a key/Pair collection.

Is there something Im missing here, as I'm not sure how I can do this. I
tried rendering and ID name to see if this would generate this effect, but
it caused the event not to fire.

Any Ideas would be welcome.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Nov 18 '05 #1
Share this Question
Share on Google+
21 Replies


P: n/a
I resolved this by using Hidden Input tags, but there must be an easier
slicker way to do this?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
When using a custom control. In order to check and see if values have
changed one has to implement the IPostBackDataCollection interface. The
values returned for the control seem to be simply a string with comma
delimited values.

For example, if I were to render two text boxes. One with the Value Terry
and the Other with the Value 'Burns' I would get the following value

Terry,Burns.

I need this to be more like this

Forname,Terry,Surname,Burns. So I get get this into a key/Pair collection.
Is there something Im missing here, as I'm not sure how I can do this. I
tried rendering and ID name to see if this would generate this effect, but
it caused the event not to fire.

Any Ideas would be welcome.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Nov 18 '05 #2

P: n/a
Only the person who developed the custom Control can answer this question.
We don't have the source code.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
When using a custom control. In order to check and see if values have
changed one has to implement the IPostBackDataCollection interface. The
values returned for the control seem to be simply a string with comma
delimited values.

For example, if I were to render two text boxes. One with the Value Terry
and the Other with the Value 'Burns' I would get the following value

Terry,Burns.

I need this to be more like this

Forname,Terry,Surname,Burns. So I get get this into a key/Pair collection.
Is there something Im missing here, as I'm not sure how I can do this. I
tried rendering and ID name to see if this would generate this effect, but
it caused the event not to fire.

Any Ideas would be welcome.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Nov 18 '05 #3

P: n/a
Well that would be me.

My question is one of concept, not regarding the particular control in
question.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
Only the person who developed the custom Control can answer this question.
We don't have the source code.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:OA**************@TK2MSFTNGP10.phx.gbl...
When using a custom control. In order to check and see if values have
changed one has to implement the IPostBackDataCollection interface. The
values returned for the control seem to be simply a string with comma
delimited values.

For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns' I would get the following value

Terry,Burns.

I need this to be more like this

Forname,Terry,Surname,Burns. So I get get this into a key/Pair

collection.

Is there something Im missing here, as I'm not sure how I can do this. I
tried rendering and ID name to see if this would generate this effect, but it caused the event not to fire.

Any Ideas would be welcome.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .


Nov 18 '05 #4

P: n/a
> Well that would be me.

My question is one of concept, not regarding the particular control in
question.
In that case, can you tell us what you mean by "the values returned by the
Controls"? A Control is a class, and doesn't return a value. I'm sure you
mean something by this, but I can't figure out what.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:#w**************@TK2MSFTNGP10.phx.gbl... Well that would be me.

My question is one of concept, not regarding the particular control in
question.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
Only the person who developed the custom Control can answer this question.
We don't have the source code.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:OA**************@TK2MSFTNGP10.phx.gbl...
When using a custom control. In order to check and see if values have
changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a string with comma
delimited values.

For example, if I were to render two text boxes. One with the Value

Terry and the Other with the Value 'Burns' I would get the following value

Terry,Burns.

I need this to be more like this

Forname,Terry,Surname,Burns. So I get get this into a key/Pair

collection.

Is there something Im missing here, as I'm not sure how I can do this. I tried rendering and ID name to see if this would generate this effect, but it caused the event not to fire.

Any Ideas would be welcome.
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .



Nov 18 '05 #5

P: n/a
OK, lets try this one more time.

A custom control allows you to present itself any way you choose rendering
HTML. In the custom control I was writing, I simply wanted a number of text
boxes to return their data and persist in viewstate.

In order to facilitate this your control must implement the
IPostBackDataCollection interface. However, the following function returns
all the postback data from the web forms and allows you to get the data
specifically for your custom control.
Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As System.Collections.Specialized.NameValueCollection ) As
Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData

BUT. . . If you examine the returned value for your cc, this is simply a
number of string values for the elements of the control .

My question was this. Does a slicker way exist to get these values in a
value/pair collection or do we have to resort to adding hidden html fields
so that we can store the FieldName as well as the values. remember, ASP.NET
does not know about the controls within the CC.

Hope this explains a aliitle better
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:up*************@TK2MSFTNGP10.phx.gbl...
Well that would be me.

My question is one of concept, not regarding the particular control in
question.
In that case, can you tell us what you mean by "the values returned by the
Controls"? A Control is a class, and doesn't return a value. I'm sure you
mean something by this, but I can't figure out what.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message news:#w**************@TK2MSFTNGP10.phx.gbl...
Well that would be me.

My question is one of concept, not regarding the particular control in
question.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
Only the person who developed the custom Control can answer this question. We don't have the source code.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
> When using a custom control. In order to check and see if values have > changed one has to implement the IPostBackDataCollection interface. The > values returned for the control seem to be simply a string with comma > delimited values.
>
> For example, if I were to render two text boxes. One with the Value

Terry
> and the Other with the Value 'Burns' I would get the following value
>
> Terry,Burns.
>
> I need this to be more like this
>
> Forname,Terry,Surname,Burns. So I get get this into a key/Pair
collection.
>
> Is there something Im missing here, as I'm not sure how I can do
this. I > tried rendering and ID name to see if this would generate this
effect, but
> it caused the event not to fire.
>
> Any Ideas would be welcome.
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
>



Nov 18 '05 #6

P: n/a
Actually, that function returns a boolean value, either True or False.
Again, I'm having some trouble understanding your question. However, I have
written some articles on developing custom Server Controls, which may help:

http://www.takempis.com/aspnet_fundamentals.asp
http://www.takempis.com/aspnet_controls.asp
http://www.takempis.com/aspnet_anatomy1.asp
http://www.takempis.com/aspnet_anatomy2.asp
http://www.takempis.com/aspnet_anatomy3.asp

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:ua**************@TK2MSFTNGP10.phx.gbl...
OK, lets try this one more time.

A custom control allows you to present itself any way you choose rendering
HTML. In the custom control I was writing, I simply wanted a number of text boxes to return their data and persist in viewstate.

In order to facilitate this your control must implement the
IPostBackDataCollection interface. However, the following function returns
all the postback data from the web forms and allows you to get the data
specifically for your custom control.
Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As System.Collections.Specialized.NameValueCollection ) As
Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData

BUT. . . If you examine the returned value for your cc, this is simply a
number of string values for the elements of the control .

My question was this. Does a slicker way exist to get these values in a
value/pair collection or do we have to resort to adding hidden html fields
so that we can store the FieldName as well as the values. remember, ASP.NET does not know about the controls within the CC.

Hope this explains a aliitle better
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:up*************@TK2MSFTNGP10.phx.gbl...
Well that would be me.

My question is one of concept, not regarding the particular control in
question.


In that case, can you tell us what you mean by "the values returned by the
Controls"? A Control is a class, and doesn't return a value. I'm sure you mean something by this, but I can't figure out what.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:#w**************@TK2MSFTNGP10.phx.gbl...
Well that would be me.

My question is one of concept, not regarding the particular control in
question.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e7**************@TK2MSFTNGP10.phx.gbl...
> Only the person who developed the custom Control can answer this

question.
> We don't have the source code.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:OA**************@TK2MSFTNGP10.phx.gbl...
> > When using a custom control. In order to check and see if values have > > changed one has to implement the IPostBackDataCollection interface. The
> > values returned for the control seem to be simply a string with comma > > delimited values.
> >
> > For example, if I were to render two text boxes. One with the
Value Terry
> > and the Other with the Value 'Burns' I would get the following value > >
> > Terry,Burns.
> >
> > I need this to be more like this
> >
> > Forname,Terry,Surname,Burns. So I get get this into a key/Pair
> collection.
> >
> > Is there something Im missing here, as I'm not sure how I can do

this.
I
> > tried rendering and ID name to see if this would generate this

effect, but
> > it caused the event not to fire.
> >
> > Any Ideas would be welcome.
> >
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> >
>
>



Nov 18 '05 #7

P: n/a
No no, I'm not refering to the Return value of the function , I'm refering
to the values passed TO the function which contain the data for the control.

postCollection(PostDataKey) is passed, the key is the ID of the control and
the data value in the collection is a string containing the HTML element
values. So if you have two text boxes with values of Me and You, then
returned is "Me,You"

Now do you see what Im driving at ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Actually, that function returns a boolean value, either True or False.
Again, I'm having some trouble understanding your question. However, I have written some articles on developing custom Server Controls, which may help:
http://www.takempis.com/aspnet_fundamentals.asp
http://www.takempis.com/aspnet_controls.asp
http://www.takempis.com/aspnet_anatomy1.asp
http://www.takempis.com/aspnet_anatomy2.asp
http://www.takempis.com/aspnet_anatomy3.asp

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:ua**************@TK2MSFTNGP10.phx.gbl...
OK, lets try this one more time.

A custom control allows you to present itself any way you choose rendering
HTML. In the custom control I was writing, I simply wanted a number of

text
boxes to return their data and persist in viewstate.

In order to facilitate this your control must implement the
IPostBackDataCollection interface. However, the following function returns all the postback data from the web forms and allows you to get the data
specifically for your custom control.
Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As System.Collections.Specialized.NameValueCollection ) As
Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData

BUT. . . If you examine the returned value for your cc, this is simply a
number of string values for the elements of the control .

My question was this. Does a slicker way exist to get these values in a
value/pair collection or do we have to resort to adding hidden html fields so that we can store the FieldName as well as the values. remember,

ASP.NET
does not know about the controls within the CC.

Hope this explains a aliitle better
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:up*************@TK2MSFTNGP10.phx.gbl...
> Well that would be me.
>
> My question is one of concept, not regarding the particular control in > question.

In that case, can you tell us what you mean by "the values returned by

the Controls"? A Control is a class, and doesn't return a value. I'm sure you mean something by this, but I can't figure out what.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:#w**************@TK2MSFTNGP10.phx.gbl...
> Well that would be me.
>
> My question is one of concept, not regarding the particular control in > question.
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Kevin Spencer" <ks******@takempis.com> wrote in message
> news:e7**************@TK2MSFTNGP10.phx.gbl...
> > Only the person who developed the custom Control can answer this
question.
> > We don't have the source code.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in > message
> > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > When using a custom control. In order to check and see if values

have
> > > changed one has to implement the IPostBackDataCollection interface. The
> > > values returned for the control seem to be simply a string with

comma
> > > delimited values.
> > >
> > > For example, if I were to render two text boxes. One with the Value > Terry
> > > and the Other with the Value 'Burns' I would get the following value > > >
> > > Terry,Burns.
> > >
> > > I need this to be more like this
> > >
> > > Forname,Terry,Surname,Burns. So I get get this into a key/Pair
> > collection.
> > >
> > > Is there something Im missing here, as I'm not sure how I can do

this.
I
> > > tried rendering and ID name to see if this would generate this

effect,
> but
> > > it caused the event not to fire.
> > >
> > > Any Ideas would be welcome.
> > >
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #8

P: n/a
PS. Thanks for trying to help anyway, it's appreciated.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Actually, that function returns a boolean value, either True or False.
Again, I'm having some trouble understanding your question. However, I have written some articles on developing custom Server Controls, which may help:
http://www.takempis.com/aspnet_fundamentals.asp
http://www.takempis.com/aspnet_controls.asp
http://www.takempis.com/aspnet_anatomy1.asp
http://www.takempis.com/aspnet_anatomy2.asp
http://www.takempis.com/aspnet_anatomy3.asp

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:ua**************@TK2MSFTNGP10.phx.gbl...
OK, lets try this one more time.

A custom control allows you to present itself any way you choose rendering
HTML. In the custom control I was writing, I simply wanted a number of

text
boxes to return their data and persist in viewstate.

In order to facilitate this your control must implement the
IPostBackDataCollection interface. However, the following function returns all the postback data from the web forms and allows you to get the data
specifically for your custom control.
Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As System.Collections.Specialized.NameValueCollection ) As
Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData

BUT. . . If you examine the returned value for your cc, this is simply a
number of string values for the elements of the control .

My question was this. Does a slicker way exist to get these values in a
value/pair collection or do we have to resort to adding hidden html fields so that we can store the FieldName as well as the values. remember,

ASP.NET
does not know about the controls within the CC.

Hope this explains a aliitle better
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:up*************@TK2MSFTNGP10.phx.gbl...
> Well that would be me.
>
> My question is one of concept, not regarding the particular control in > question.

In that case, can you tell us what you mean by "the values returned by

the Controls"? A Control is a class, and doesn't return a value. I'm sure you mean something by this, but I can't figure out what.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:#w**************@TK2MSFTNGP10.phx.gbl...
> Well that would be me.
>
> My question is one of concept, not regarding the particular control in > question.
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Kevin Spencer" <ks******@takempis.com> wrote in message
> news:e7**************@TK2MSFTNGP10.phx.gbl...
> > Only the person who developed the custom Control can answer this
question.
> > We don't have the source code.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in > message
> > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > When using a custom control. In order to check and see if values

have
> > > changed one has to implement the IPostBackDataCollection interface. The
> > > values returned for the control seem to be simply a string with

comma
> > > delimited values.
> > >
> > > For example, if I were to render two text boxes. One with the Value > Terry
> > > and the Other with the Value 'Burns' I would get the following value > > >
> > > Terry,Burns.
> > >
> > > I need this to be more like this
> > >
> > > Forname,Terry,Surname,Burns. So I get get this into a key/Pair
> > collection.
> > >
> > > Is there something Im missing here, as I'm not sure how I can do

this.
I
> > > tried rendering and ID name to see if this would generate this

effect,
> but
> > > it caused the event not to fire.
> > >
> > > Any Ideas would be welcome.
> > >
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #9

P: n/a
If you have 2 textboxes coming into the PostDataCollection as a single
comma-delimited item, they must have the same "name" attribute on the
client. The HTML form posts the data in the form as name/value pairs, using
the "name" attribute of the client-side form field to link the data with the
form field on the client.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:#Y**************@TK2MSFTNGP11.phx.gbl...
No no, I'm not refering to the Return value of the function , I'm refering
to the values passed TO the function which contain the data for the control.
postCollection(PostDataKey) is passed, the key is the ID of the control and the data value in the collection is a string containing the HTML element
values. So if you have two text boxes with values of Me and You, then
returned is "Me,You"

Now do you see what Im driving at ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Actually, that function returns a boolean value, either True or False.
Again, I'm having some trouble understanding your question. However, I have
written some articles on developing custom Server Controls, which may

help:

http://www.takempis.com/aspnet_fundamentals.asp
http://www.takempis.com/aspnet_controls.asp
http://www.takempis.com/aspnet_anatomy1.asp
http://www.takempis.com/aspnet_anatomy2.asp
http://www.takempis.com/aspnet_anatomy3.asp

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:ua**************@TK2MSFTNGP10.phx.gbl...
OK, lets try this one more time.

A custom control allows you to present itself any way you choose rendering HTML. In the custom control I was writing, I simply wanted a number of
text
boxes to return their data and persist in viewstate.

In order to facilitate this your control must implement the
IPostBackDataCollection interface. However, the following function returns all the postback data from the web forms and allows you to get the
data specifically for your custom control.
Public Function LoadPostData(ByVal postDataKey As String, ByVal
postCollection As System.Collections.Specialized.NameValueCollection ) As Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData

BUT. . . If you examine the returned value for your cc, this is simply a number of string values for the elements of the control .

My question was this. Does a slicker way exist to get these values in a value/pair collection or do we have to resort to adding hidden html fields so that we can store the FieldName as well as the values. remember,

ASP.NET
does not know about the controls within the CC.

Hope this explains a aliitle better
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:up*************@TK2MSFTNGP10.phx.gbl...
> > Well that would be me.
> >
> > My question is one of concept, not regarding the particular control in
> > question.
>
> In that case, can you tell us what you mean by "the values returned
by the
> Controls"? A Control is a class, and doesn't return a value. I'm
sure you
> mean something by this, but I can't figure out what.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:#w**************@TK2MSFTNGP10.phx.gbl...
> > Well that would be me.
> >
> > My question is one of concept, not regarding the particular
control in > > question.
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > Only the person who developed the custom Control can answer this
> question.
> > > We don't have the source code.
> > >
> > > --
> > > HTH,
> > > Kevin Spencer
> > > .Net Developer
> > > Microsoft MVP
> > > Big things are made up
> > > of lots of little things.
> > >
> > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>
wrote
in > > message
> > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > When using a custom control. In order to check and see if

values have
> > > > changed one has to implement the IPostBackDataCollection

interface.
> The
> > > > values returned for the control seem to be simply a string with comma
> > > > delimited values.
> > > >
> > > > For example, if I were to render two text boxes. One with the

Value
> > Terry
> > > > and the Other with the Value 'Burns' I would get the following

value
> > > >
> > > > Terry,Burns.
> > > >
> > > > I need this to be more like this
> > > >
> > > > Forname,Terry,Surname,Burns. So I get get this into a key/Pair > > > collection.
> > > >
> > > > Is there something Im missing here, as I'm not sure how I can do this.
> I
> > > > tried rendering and ID name to see if this would generate this
effect,
> > but
> > > > it caused the event not to fire.
> > > >
> > > > Any Ideas would be welcome.
> > > >
> > > >
> > > > --
> > > >
> > > > OHM ( Terry Burns )
> > > > . . . One-Handed-Man . . .
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #10

P: n/a
kevin,
I do appreciate your help here, but we seem to have some kind of
disconnect. Either I am functionally inoperative or we simply dont
understand each other.

PostDataCollection(PostDataKey) returns the CustomControl data. This is just
a string of concatenated strings.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e%***************@TK2MSFTNGP11.phx.gbl...
If you have 2 textboxes coming into the PostDataCollection as a single
comma-delimited item, they must have the same "name" attribute on the
client. The HTML form posts the data in the form as name/value pairs, using the "name" attribute of the client-side form field to link the data with the form field on the client.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:#Y**************@TK2MSFTNGP11.phx.gbl...
No no, I'm not refering to the Return value of the function , I'm refering
to the values passed TO the function which contain the data for the control.

postCollection(PostDataKey) is passed, the key is the ID of the control

and
the data value in the collection is a string containing the HTML element
values. So if you have two text boxes with values of Me and You, then
returned is "Me,You"

Now do you see what Im driving at ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Actually, that function returns a boolean value, either True or False.
Again, I'm having some trouble understanding your question. However, I

have
written some articles on developing custom Server Controls, which may

help:

http://www.takempis.com/aspnet_fundamentals.asp
http://www.takempis.com/aspnet_controls.asp
http://www.takempis.com/aspnet_anatomy1.asp
http://www.takempis.com/aspnet_anatomy2.asp
http://www.takempis.com/aspnet_anatomy3.asp

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:ua**************@TK2MSFTNGP10.phx.gbl...
> OK, lets try this one more time.
>
> A custom control allows you to present itself any way you choose

rendering
> HTML. In the custom control I was writing, I simply wanted a number

of text
> boxes to return their data and persist in viewstate.
>
> In order to facilitate this your control must implement the
> IPostBackDataCollection interface. However, the following function

returns
> all the postback data from the web forms and allows you to get the data > specifically for your custom control.
> Public Function LoadPostData(ByVal postDataKey As String, ByVal
> postCollection As System.Collections.Specialized.NameValueCollection ) As
> Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData
>
> BUT. . . If you examine the returned value for your cc, this is
simply
a > number of string values for the elements of the control .
>
> My question was this. Does a slicker way exist to get these values
in
a > value/pair collection or do we have to resort to adding hidden html fields
> so that we can store the FieldName as well as the values. remember,
ASP.NET
> does not know about the controls within the CC.
>
> Hope this explains a aliitle better
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Kevin Spencer" <ks******@takempis.com> wrote in message
> news:up*************@TK2MSFTNGP10.phx.gbl...
> > > Well that would be me.
> > >
> > > My question is one of concept, not regarding the particular control
in
> > > question.
> >
> > In that case, can you tell us what you mean by "the values

returned by the
> > Controls"? A Control is a class, and doesn't return a value. I'm sure you
> > mean something by this, but I can't figure out what.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in > message
> > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > Well that would be me.
> > >
> > > My question is one of concept, not regarding the particular
control
in
> > > question.
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > Only the person who developed the custom Control can answer this > > question.
> > > > We don't have the source code.
> > > >
> > > > --
> > > > HTH,
> > > > Kevin Spencer
> > > > .Net Developer
> > > > Microsoft MVP
> > > > Big things are made up
> > > > of lots of little things.
> > > >
> > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote
in
> > > message
> > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > When using a custom control. In order to check and see if

values > have
> > > > > changed one has to implement the IPostBackDataCollection
interface.
> > The
> > > > > values returned for the control seem to be simply a string with > comma
> > > > > delimited values.
> > > > >
> > > > > For example, if I were to render two text boxes. One with the Value
> > > Terry
> > > > > and the Other with the Value 'Burns' I would get the following value
> > > > >
> > > > > Terry,Burns.
> > > > >
> > > > > I need this to be more like this
> > > > >
> > > > > Forname,Terry,Surname,Burns. So I get get this into a key/Pair > > > > collection.
> > > > >
> > > > > Is there something Im missing here, as I'm not sure how I can do
> this.
> > I
> > > > > tried rendering and ID name to see if this would generate

this > effect,
> > > but
> > > > > it caused the event not to fire.
> > > > >
> > > > > Any Ideas would be welcome.
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > OHM ( Terry Burns )
> > > > > . . . One-Handed-Man . . .
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #11

P: n/a
The PostDataCollection is simply a Collection of the form field data posted
by the client form. HTML Form data is posted using name=value pairs. If a
single entry (PostDataCollection(PostDataKey) is a single entry) contains
more than one value, delimited by one or more commas, it contains the values
of more than one form field having the same name attribute on the client.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:uf**************@TK2MSFTNGP09.phx.gbl...
kevin,
I do appreciate your help here, but we seem to have some kind of disconnect. Either I am functionally inoperative or we simply dont
understand each other.

PostDataCollection(PostDataKey) returns the CustomControl data. This is just a string of concatenated strings.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e%***************@TK2MSFTNGP11.phx.gbl...
If you have 2 textboxes coming into the PostDataCollection as a single
comma-delimited item, they must have the same "name" attribute on the
client. The HTML form posts the data in the form as name/value pairs, using
the "name" attribute of the client-side form field to link the data with

the
form field on the client.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:#Y**************@TK2MSFTNGP11.phx.gbl...
No no, I'm not refering to the Return value of the function , I'm refering to the values passed TO the function which contain the data for the

control.

postCollection(PostDataKey) is passed, the key is the ID of the control
and
the data value in the collection is a string containing the HTML
element values. So if you have two text boxes with values of Me and You, then
returned is "Me,You"

Now do you see what Im driving at ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
> Actually, that function returns a boolean value, either True or False. > Again, I'm having some trouble understanding your question. However, I have
> written some articles on developing custom Server Controls, which may help:
>
> http://www.takempis.com/aspnet_fundamentals.asp
> http://www.takempis.com/aspnet_controls.asp
> http://www.takempis.com/aspnet_anatomy1.asp
> http://www.takempis.com/aspnet_anatomy2.asp
> http://www.takempis.com/aspnet_anatomy3.asp
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:ua**************@TK2MSFTNGP10.phx.gbl...
> > OK, lets try this one more time.
> >
> > A custom control allows you to present itself any way you choose
rendering
> > HTML. In the custom control I was writing, I simply wanted a number
of
> text
> > boxes to return their data and persist in viewstate.
> >
> > In order to facilitate this your control must implement the
> > IPostBackDataCollection interface. However, the following function
returns
> > all the postback data from the web forms and allows you to get the

data
> > specifically for your custom control.
> > Public Function LoadPostData(ByVal postDataKey As String, ByVal
> > postCollection As

System.Collections.Specialized.NameValueCollection )
As
> > Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData
> >
> > BUT. . . If you examine the returned value for your cc, this is

simply
a
> > number of string values for the elements of the control .
> >
> > My question was this. Does a slicker way exist to get these values

in
a
> > value/pair collection or do we have to resort to adding hidden

html fields
> > so that we can store the FieldName as well as the values. remember, > ASP.NET
> > does not know about the controls within the CC.
> >
> > Hope this explains a aliitle better
> >
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > Well that would be me.
> > > >
> > > > My question is one of concept, not regarding the particular

control
in
> > > > question.
> > >
> > > In that case, can you tell us what you mean by "the values

returned
by
> the
> > > Controls"? A Control is a class, and doesn't return a value. I'm

sure
> you
> > > mean something by this, but I can't figure out what.
> > >
> > > --
> > > HTH,
> > > Kevin Spencer
> > > .Net Developer
> > > Microsoft MVP
> > > Big things are made up
> > > of lots of little things.
> > >
> > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote in > > message
> > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > Well that would be me.
> > > >
> > > > My question is one of concept, not regarding the particular

control
in
> > > > question.
> > > >
> > > > --
> > > >
> > > > OHM ( Terry Burns )
> > > > . . . One-Handed-Man . . .
> > > >
> > > >
> > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > Only the person who developed the custom Control can answer this > > > question.
> > > > > We don't have the source code.
> > > > >
> > > > > --
> > > > > HTH,
> > > > > Kevin Spencer
> > > > > .Net Developer
> > > > > Microsoft MVP
> > > > > Big things are made up
> > > > > of lots of little things.
> > > > >
> > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote
in
> > > > message
> > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > When using a custom control. In order to check and see if

values
> > have
> > > > > > changed one has to implement the IPostBackDataCollection
> interface.
> > > The
> > > > > > values returned for the control seem to be simply a string

with
> > comma
> > > > > > delimited values.
> > > > > >
> > > > > > For example, if I were to render two text boxes. One with the > Value
> > > > Terry
> > > > > > and the Other with the Value 'Burns' I would get the following > value
> > > > > >
> > > > > > Terry,Burns.
> > > > > >
> > > > > > I need this to be more like this
> > > > > >
> > > > > > Forname,Terry,Surname,Burns. So I get get this into a

key/Pair
> > > > > collection.
> > > > > >
> > > > > > Is there something Im missing here, as I'm not sure how I can
do
> > this.
> > > I
> > > > > > tried rendering and ID name to see if this would generate

this > > effect,
> > > > but
> > > > > > it caused the event not to fire.
> > > > > >
> > > > > > Any Ideas would be welcome.
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > OHM ( Terry Burns )
> > > > > > . . . One-Handed-Man . . .
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #12

P: n/a
Hi Kevin, Thanks for coming back on this one.

Yes, correct !

Now, we have arrived at the understanding, the question is that I was hoping
that this data could be represented as value/key pairs. To better illustrate
what I mean, lets say we take this string and split it and make use of its
elements in our code on the host form.

What if we need to change the layout of our custom control ?, this means we
have to go back and re-jig the code. If however, we could arrange things so
that the ID of the Field allways preceeded the value, we could create a
collection of key/Value pairs in their own right, thus freeing us from the
concerns about layout and modifications.

And thats what I'm after !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
The PostDataCollection is simply a Collection of the form field data posted by the client form. HTML Form data is posted using name=value pairs. If a
single entry (PostDataCollection(PostDataKey) is a single entry) contains
more than one value, delimited by one or more commas, it contains the values of more than one form field having the same name attribute on the client.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:uf**************@TK2MSFTNGP09.phx.gbl...
kevin,
I do appreciate your help here, but we seem to have some kind of
disconnect. Either I am functionally inoperative or we simply dont
understand each other.

PostDataCollection(PostDataKey) returns the CustomControl data. This is

just
a string of concatenated strings.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e%***************@TK2MSFTNGP11.phx.gbl...
If you have 2 textboxes coming into the PostDataCollection as a single
comma-delimited item, they must have the same "name" attribute on the
client. The HTML form posts the data in the form as name/value pairs,

using
the "name" attribute of the client-side form field to link the data with
the
form field on the client.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:#Y**************@TK2MSFTNGP11.phx.gbl...
> No no, I'm not refering to the Return value of the function , I'm

refering
> to the values passed TO the function which contain the data for the
control.
>
> postCollection(PostDataKey) is passed, the key is the ID of the control and
> the data value in the collection is a string containing the HTML element > values. So if you have two text boxes with values of Me and You,
then > returned is "Me,You"
>
> Now do you see what Im driving at ?
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Kevin Spencer" <ks******@takempis.com> wrote in message
> news:Oo**************@TK2MSFTNGP10.phx.gbl...
> > Actually, that function returns a boolean value, either True or False. > > Again, I'm having some trouble understanding your question. However, I
> have
> > written some articles on developing custom Server Controls, which may > help:
> >
> > http://www.takempis.com/aspnet_fundamentals.asp
> > http://www.takempis.com/aspnet_controls.asp
> > http://www.takempis.com/aspnet_anatomy1.asp
> > http://www.takempis.com/aspnet_anatomy2.asp
> > http://www.takempis.com/aspnet_anatomy3.asp
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in > message
> > news:ua**************@TK2MSFTNGP10.phx.gbl...
> > > OK, lets try this one more time.
> > >
> > > A custom control allows you to present itself any way you choose
> rendering
> > > HTML. In the custom control I was writing, I simply wanted a

number of
> > text
> > > boxes to return their data and persist in viewstate.
> > >
> > > In order to facilitate this your control must implement the
> > > IPostBackDataCollection interface. However, the following function > returns
> > > all the postback data from the web forms and allows you to get the data
> > > specifically for your custom control.
> > > Public Function LoadPostData(ByVal postDataKey As String, ByVal
> > > postCollection As

System.Collections.Specialized.NameValueCollection )
As
> > > Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData > > >
> > > BUT. . . If you examine the returned value for your cc, this is

simply
a
> > > number of string values for the elements of the control .
> > >
> > > My question was this. Does a slicker way exist to get these values in
a
> > > value/pair collection or do we have to resort to adding hidden html > fields
> > > so that we can store the FieldName as well as the values. remember, > > ASP.NET
> > > does not know about the controls within the CC.
> > >
> > > Hope this explains a aliitle better
> > >
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > > Well that would be me.
> > > > >
> > > > > My question is one of concept, not regarding the particular
control
> in
> > > > > question.
> > > >
> > > > In that case, can you tell us what you mean by "the values

returned
by
> > the
> > > > Controls"? A Control is a class, and doesn't return a value.
I'm sure
> > you
> > > > mean something by this, but I can't figure out what.
> > > >
> > > > --
> > > > HTH,
> > > > Kevin Spencer
> > > > .Net Developer
> > > > Microsoft MVP
> > > > Big things are made up
> > > > of lots of little things.
> > > >
> > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote
in
> > > message
> > > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > > Well that would be me.
> > > > >
> > > > > My question is one of concept, not regarding the particular
control
> in
> > > > > question.
> > > > >
> > > > > --
> > > > >
> > > > > OHM ( Terry Burns )
> > > > > . . . One-Handed-Man . . .
> > > > >
> > > > >
> > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > > Only the person who developed the custom Control can answer this
> > > > question.
> > > > > > We don't have the source code.
> > > > > >
> > > > > > --
> > > > > > HTH,
> > > > > > Kevin Spencer
> > > > > > .Net Developer
> > > > > > Microsoft MVP
> > > > > > Big things are made up
> > > > > > of lots of little things.
> > > > > >
> > > > > > "One Handed Man ( OHM - Terry Burns )"
<news.microsoft.com> wrote
> in
> > > > > message
> > > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > When using a custom control. In order to check and see if values
> > > have
> > > > > > > changed one has to implement the IPostBackDataCollection
> > interface.
> > > > The
> > > > > > > values returned for the control seem to be simply a string with
> > > comma
> > > > > > > delimited values.
> > > > > > >
> > > > > > > For example, if I were to render two text boxes. One

with the
> > Value
> > > > > Terry
> > > > > > > and the Other with the Value 'Burns' I would get the

following
> > value
> > > > > > >
> > > > > > > Terry,Burns.
> > > > > > >
> > > > > > > I need this to be more like this
> > > > > > >
> > > > > > > Forname,Terry,Surname,Burns. So I get get this into a
key/Pair
> > > > > > collection.
> > > > > > >
> > > > > > > Is there something Im missing here, as I'm not sure how
I can
do
> > > this.
> > > > I
> > > > > > > tried rendering and ID name to see if this would
generate this
> > > effect,
> > > > > but
> > > > > > > it caused the event not to fire.
> > > > > > >
> > > > > > > Any Ideas would be welcome.
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > OHM ( Terry Burns )
> > > > > > > . . . One-Handed-Man . . .
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #13

P: n/a
I'mnot following you there, Terry. However, I CAN tell you that having a
single Control having multiple form fields in it with the same name
attribute is a mistake, as the rules of HTML is not something Microsoft has
any control over.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
Hi Kevin, Thanks for coming back on this one.

Yes, correct !

Now, we have arrived at the understanding, the question is that I was hoping that this data could be represented as value/key pairs. To better illustrate what I mean, lets say we take this string and split it and make use of its
elements in our code on the host form.

What if we need to change the layout of our custom control ?, this means we have to go back and re-jig the code. If however, we could arrange things so that the ID of the Field allways preceeded the value, we could create a
collection of key/Value pairs in their own right, thus freeing us from the
concerns about layout and modifications.

And thats what I'm after !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
The PostDataCollection is simply a Collection of the form field data posted
by the client form. HTML Form data is posted using name=value pairs. If a
single entry (PostDataCollection(PostDataKey) is a single entry) contains more than one value, delimited by one or more commas, it contains the

values
of more than one form field having the same name attribute on the client.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:uf**************@TK2MSFTNGP09.phx.gbl...
kevin,
I do appreciate your help here, but we seem to have some kind
of
disconnect. Either I am functionally inoperative or we simply dont
understand each other.

PostDataCollection(PostDataKey) returns the CustomControl data. This
is just
a string of concatenated strings.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:e%***************@TK2MSFTNGP11.phx.gbl...
> If you have 2 textboxes coming into the PostDataCollection as a
single > comma-delimited item, they must have the same "name" attribute on the > client. The HTML form posts the data in the form as name/value pairs, using
> the "name" attribute of the client-side form field to link the data

with the
> form field on the client.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:#Y**************@TK2MSFTNGP11.phx.gbl...
> > No no, I'm not refering to the Return value of the function , I'm
refering
> > to the values passed TO the function which contain the data for the > control.
> >
> > postCollection(PostDataKey) is passed, the key is the ID of the

control
> and
> > the data value in the collection is a string containing the HTML

element
> > values. So if you have two text boxes with values of Me and You, then > > returned is "Me,You"
> >
> > Now do you see what Im driving at ?
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > news:Oo**************@TK2MSFTNGP10.phx.gbl...
> > > Actually, that function returns a boolean value, either True or

False.
> > > Again, I'm having some trouble understanding your question. However,
I
> > have
> > > written some articles on developing custom Server Controls, which may
> > help:
> > >
> > > http://www.takempis.com/aspnet_fundamentals.asp
> > > http://www.takempis.com/aspnet_controls.asp
> > > http://www.takempis.com/aspnet_anatomy1.asp
> > > http://www.takempis.com/aspnet_anatomy2.asp
> > > http://www.takempis.com/aspnet_anatomy3.asp
> > >
> > > --
> > > HTH,
> > > Kevin Spencer
> > > .Net Developer
> > > Microsoft MVP
> > > Big things are made up
> > > of lots of little things.
> > >
> > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote in > > message
> > > news:ua**************@TK2MSFTNGP10.phx.gbl...
> > > > OK, lets try this one more time.
> > > >
> > > > A custom control allows you to present itself any way you
choose > > rendering
> > > > HTML. In the custom control I was writing, I simply wanted a number
> of
> > > text
> > > > boxes to return their data and persist in viewstate.
> > > >
> > > > In order to facilitate this your control must implement the
> > > > IPostBackDataCollection interface. However, the following

function > > returns
> > > > all the postback data from the web forms and allows you to get the > data
> > > > specifically for your custom control.
> > > > Public Function LoadPostData(ByVal postDataKey As String, ByVal > > > > postCollection As
System.Collections.Specialized.NameValueCollection )
> As
> > > > Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData > > > >
> > > > BUT. . . If you examine the returned value for your cc, this is simply
> a
> > > > number of string values for the elements of the control .
> > > >
> > > > My question was this. Does a slicker way exist to get these values in
> a
> > > > value/pair collection or do we have to resort to adding hidden

html
> > fields
> > > > so that we can store the FieldName as well as the values.

remember,
> > > ASP.NET
> > > > does not know about the controls within the CC.
> > > >
> > > > Hope this explains a aliitle better
> > > >
> > > >
> > > > --
> > > >
> > > > OHM ( Terry Burns )
> > > > . . . One-Handed-Man . . .
> > > >
> > > >
> > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > > > Well that would be me.
> > > > > >
> > > > > > My question is one of concept, not regarding the particular > control
> > in
> > > > > > question.
> > > > >
> > > > > In that case, can you tell us what you mean by "the values
returned
> by
> > > the
> > > > > Controls"? A Control is a class, and doesn't return a value. I'm > sure
> > > you
> > > > > mean something by this, but I can't figure out what.
> > > > >
> > > > > --
> > > > > HTH,
> > > > > Kevin Spencer
> > > > > .Net Developer
> > > > > Microsoft MVP
> > > > > Big things are made up
> > > > > of lots of little things.
> > > > >
> > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote
in
> > > > message
> > > > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > > > Well that would be me.
> > > > > >
> > > > > > My question is one of concept, not regarding the particular > control
> > in
> > > > > > question.
> > > > > >
> > > > > > --
> > > > > >
> > > > > > OHM ( Terry Burns )
> > > > > > . . . One-Handed-Man . . .
> > > > > >
> > > > > >
> > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > Only the person who developed the custom Control can answer this
> > > > > question.
> > > > > > > We don't have the source code.
> > > > > > >
> > > > > > > --
> > > > > > > HTH,
> > > > > > > Kevin Spencer
> > > > > > > .Net Developer
> > > > > > > Microsoft MVP
> > > > > > > Big things are made up
> > > > > > > of lots of little things.
> > > > > > >
> > > > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> > wrote
> > in
> > > > > > message
> > > > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > When using a custom control. In order to check and see if > values
> > > > have
> > > > > > > > changed one has to implement the IPostBackDataCollection > > > interface.
> > > > > The
> > > > > > > > values returned for the control seem to be simply a string > with
> > > > comma
> > > > > > > > delimited values.
> > > > > > > >
> > > > > > > > For example, if I were to render two text boxes. One with the
> > > Value
> > > > > > Terry
> > > > > > > > and the Other with the Value 'Burns' I would get the
following
> > > value
> > > > > > > >
> > > > > > > > Terry,Burns.
> > > > > > > >
> > > > > > > > I need this to be more like this
> > > > > > > >
> > > > > > > > Forname,Terry,Surname,Burns. So I get get this into a
> key/Pair
> > > > > > > collection.
> > > > > > > >
> > > > > > > > Is there something Im missing here, as I'm not sure
how I can
> do
> > > > this.
> > > > > I
> > > > > > > > tried rendering and ID name to see if this would generate this
> > > > effect,
> > > > > > but
> > > > > > > > it caused the event not to fire.
> > > > > > > >
> > > > > > > > Any Ideas would be welcome.
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > OHM ( Terry Burns )
> > > > > > > > . . . One-Handed-Man . . .
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #14

P: n/a
No, they are not the same name. My Senario . . .

--- MY Custom Control -- - -

<Input id=txtName . . . . . value="MyFirstName">
<Input id=txtAddress . . . . .value="MyAddress">

--------------------------------
The output from the control ( value ) in the PostBackCollection(MyControlID)
is

"MyFirstName,MyAddress"



--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'mnot following you there, Terry. However, I CAN tell you that having a
single Control having multiple form fields in it with the same name
attribute is a mistake, as the rules of HTML is not something Microsoft has any control over.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:Oc**************@TK2MSFTNGP11.phx.gbl...
Hi Kevin, Thanks for coming back on this one.

Yes, correct !

Now, we have arrived at the understanding, the question is that I was hoping
that this data could be represented as value/key pairs. To better

illustrate
what I mean, lets say we take this string and split it and make use of its
elements in our code on the host form.

What if we need to change the layout of our custom control ?, this means

we
have to go back and re-jig the code. If however, we could arrange things

so
that the ID of the Field allways preceeded the value, we could create a
collection of key/Value pairs in their own right, thus freeing us from the concerns about layout and modifications.

And thats what I'm after !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
The PostDataCollection is simply a Collection of the form field data

posted
by the client form. HTML Form data is posted using name=value pairs. If a single entry (PostDataCollection(PostDataKey) is a single entry) contains more than one value, delimited by one or more commas, it contains the

values
of more than one form field having the same name attribute on the client.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:uf**************@TK2MSFTNGP09.phx.gbl...
> kevin,
> I do appreciate your help here, but we seem to have some kind of
> disconnect. Either I am functionally inoperative or we simply dont
> understand each other.
>
> PostDataCollection(PostDataKey) returns the CustomControl data. This is just
> a string of concatenated strings.
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Kevin Spencer" <ks******@takempis.com> wrote in message
> news:e%***************@TK2MSFTNGP11.phx.gbl...
> > If you have 2 textboxes coming into the PostDataCollection as a single > > comma-delimited item, they must have the same "name" attribute on the > > client. The HTML form posts the data in the form as name/value pairs, > using
> > the "name" attribute of the client-side form field to link the
data
with
> the
> > form field on the client.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in > message
> > news:#Y**************@TK2MSFTNGP11.phx.gbl...
> > > No no, I'm not refering to the Return value of the function , I'm > refering
> > > to the values passed TO the function which contain the data for

the > > control.
> > >
> > > postCollection(PostDataKey) is passed, the key is the ID of the
control
> > and
> > > the data value in the collection is a string containing the HTML
element
> > > values. So if you have two text boxes with values of Me and You,

then
> > > returned is "Me,You"
> > >
> > > Now do you see what Im driving at ?
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > news:Oo**************@TK2MSFTNGP10.phx.gbl...
> > > > Actually, that function returns a boolean value, either True or False.
> > > > Again, I'm having some trouble understanding your question.

However,
I
> > > have
> > > > written some articles on developing custom Server Controls, which may
> > > help:
> > > >
> > > > http://www.takempis.com/aspnet_fundamentals.asp
> > > > http://www.takempis.com/aspnet_controls.asp
> > > > http://www.takempis.com/aspnet_anatomy1.asp
> > > > http://www.takempis.com/aspnet_anatomy2.asp
> > > > http://www.takempis.com/aspnet_anatomy3.asp
> > > >
> > > > --
> > > > HTH,
> > > > Kevin Spencer
> > > > .Net Developer
> > > > Microsoft MVP
> > > > Big things are made up
> > > > of lots of little things.
> > > >
> > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in
> > > message
> > > > news:ua**************@TK2MSFTNGP10.phx.gbl...
> > > > > OK, lets try this one more time.
> > > > >
> > > > > A custom control allows you to present itself any way you

choose > > > rendering
> > > > > HTML. In the custom control I was writing, I simply wanted a number
> > of
> > > > text
> > > > > boxes to return their data and persist in viewstate.
> > > > >
> > > > > In order to facilitate this your control must implement the
> > > > > IPostBackDataCollection interface. However, the following

function
> > > returns
> > > > > all the postback data from the web forms and allows you to get the
> > data
> > > > > specifically for your custom control.
> > > > > Public Function LoadPostData(ByVal postDataKey As String, ByVal > > > > > postCollection As
> System.Collections.Specialized.NameValueCollection )
> > As
> > > > > Boolean Implements

System.Web.UI.IPostBackDataHandler.LoadPostData
> > > > >
> > > > > BUT. . . If you examine the returned value for your cc, this is > simply
> > a
> > > > > number of string values for the elements of the control .
> > > > >
> > > > > My question was this. Does a slicker way exist to get these

values
> in
> > a
> > > > > value/pair collection or do we have to resort to adding
hidden html
> > > fields
> > > > > so that we can store the FieldName as well as the values.
remember,
> > > > ASP.NET
> > > > > does not know about the controls within the CC.
> > > > >
> > > > > Hope this explains a aliitle better
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > OHM ( Terry Burns )
> > > > > . . . One-Handed-Man . . .
> > > > >
> > > > >
> > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > > > > Well that would be me.
> > > > > > >
> > > > > > > My question is one of concept, not regarding the particular > > control
> > > in
> > > > > > > question.
> > > > > >
> > > > > > In that case, can you tell us what you mean by "the values
> returned
> > by
> > > > the
> > > > > > Controls"? A Control is a class, and doesn't return a value. I'm
> > sure
> > > > you
> > > > > > mean something by this, but I can't figure out what.
> > > > > >
> > > > > > --
> > > > > > HTH,
> > > > > > Kevin Spencer
> > > > > > .Net Developer
> > > > > > Microsoft MVP
> > > > > > Big things are made up
> > > > > > of lots of little things.
> > > > > >
> > > > > > "One Handed Man ( OHM - Terry Burns )"
<news.microsoft.com> wrote
> in
> > > > > message
> > > > > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > Well that would be me.
> > > > > > >
> > > > > > > My question is one of concept, not regarding the particular > > control
> > > in
> > > > > > > question.
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > OHM ( Terry Burns )
> > > > > > > . . . One-Handed-Man . . .
> > > > > > >
> > > > > > >
> > > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > Only the person who developed the custom Control can

answer
> this
> > > > > > question.
> > > > > > > > We don't have the source code.
> > > > > > > >
> > > > > > > > --
> > > > > > > > HTH,
> > > > > > > > Kevin Spencer
> > > > > > > > .Net Developer
> > > > > > > > Microsoft MVP
> > > > > > > > Big things are made up
> > > > > > > > of lots of little things.
> > > > > > > >
> > > > > > > > "One Handed Man ( OHM - Terry Burns )"

<news.microsoft.com>
> > wrote
> > > in
> > > > > > > message
> > > > > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > When using a custom control. In order to check and see if
> > values
> > > > > have
> > > > > > > > > changed one has to implement the IPostBackDataCollection > > > > interface.
> > > > > > The
> > > > > > > > > values returned for the control seem to be simply a

string
> > with
> > > > > comma
> > > > > > > > > delimited values.
> > > > > > > > >
> > > > > > > > > For example, if I were to render two text boxes. One

with
> the
> > > > Value
> > > > > > > Terry
> > > > > > > > > and the Other with the Value 'Burns' I would get the
> following
> > > > value
> > > > > > > > >
> > > > > > > > > Terry,Burns.
> > > > > > > > >
> > > > > > > > > I need this to be more like this
> > > > > > > > >
> > > > > > > > > Forname,Terry,Surname,Burns. So I get get this into

a > > key/Pair
> > > > > > > > collection.
> > > > > > > > >
> > > > > > > > > Is there something Im missing here, as I'm not sure

how
I
> can
> > do
> > > > > this.
> > > > > > I
> > > > > > > > > tried rendering and ID name to see if this would

generate
> this
> > > > > effect,
> > > > > > > but
> > > > > > > > > it caused the event not to fire.
> > > > > > > > >
> > > > > > > > > Any Ideas would be welcome.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > OHM ( Terry Burns )
> > > > > > > > > . . . One-Handed-Man . . .
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #15

P: n/a
The id attribute is not the name attribute.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
No, they are not the same name. My Senario . . .

--- MY Custom Control -- - -

<Input id=txtName . . . . . value="MyFirstName">
<Input id=txtAddress . . . . .value="MyAddress">

--------------------------------
The output from the control ( value ) in the PostBackCollection(MyControlID) is

"MyFirstName,MyAddress"



--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'mnot following you there, Terry. However, I CAN tell you that having a
single Control having multiple form fields in it with the same name
attribute is a mistake, as the rules of HTML is not something Microsoft has
any control over.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
Hi Kevin, Thanks for coming back on this one.

Yes, correct !

Now, we have arrived at the understanding, the question is that I was

hoping
that this data could be represented as value/key pairs. To better

illustrate
what I mean, lets say we take this string and split it and make use of its elements in our code on the host form.

What if we need to change the layout of our custom control ?, this means
we
have to go back and re-jig the code. If however, we could arrange
things
so
that the ID of the Field allways preceeded the value, we could create
a collection of key/Value pairs in their own right, thus freeing us from

the concerns about layout and modifications.

And thats what I'm after !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
> The PostDataCollection is simply a Collection of the form field data
posted
> by the client form. HTML Form data is posted using name=value pairs. If
a
> single entry (PostDataCollection(PostDataKey) is a single entry)

contains
> more than one value, delimited by one or more commas, it contains the values
> of more than one form field having the same name attribute on the

client.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:uf**************@TK2MSFTNGP09.phx.gbl...
> > kevin,
> > I do appreciate your help here, but we seem to have some kind
> of
> > disconnect. Either I am functionally inoperative or we simply dont
> > understand each other.
> >
> > PostDataCollection(PostDataKey) returns the CustomControl data.
This is
> just
> > a string of concatenated strings.
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > news:e%***************@TK2MSFTNGP11.phx.gbl...
> > > If you have 2 textboxes coming into the PostDataCollection as a

single
> > > comma-delimited item, they must have the same "name" attribute
on the
> > > client. The HTML form posts the data in the form as name/value

pairs,
> > using
> > > the "name" attribute of the client-side form field to link the data with
> > the
> > > form field on the client.
> > >
> > > --
> > > HTH,
> > > Kevin Spencer
> > > .Net Developer
> > > Microsoft MVP
> > > Big things are made up
> > > of lots of little things.
> > >
> > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>
wrote in > > message
> > > news:#Y**************@TK2MSFTNGP11.phx.gbl...
> > > > No no, I'm not refering to the Return value of the function , I'm > > refering
> > > > to the values passed TO the function which contain the data
for the
> > > control.
> > > >
> > > > postCollection(PostDataKey) is passed, the key is the ID of
the > control
> > > and
> > > > the data value in the collection is a string containing the HTML > element
> > > > values. So if you have two text boxes with values of Me and You, then
> > > > returned is "Me,You"
> > > >
> > > > Now do you see what Im driving at ?
> > > >
> > > > --
> > > >
> > > > OHM ( Terry Burns )
> > > > . . . One-Handed-Man . . .
> > > >
> > > >
> > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > news:Oo**************@TK2MSFTNGP10.phx.gbl...
> > > > > Actually, that function returns a boolean value, either True
or > False.
> > > > > Again, I'm having some trouble understanding your question.
However,
> I
> > > > have
> > > > > written some articles on developing custom Server Controls,

which
> may
> > > > help:
> > > > >
> > > > > http://www.takempis.com/aspnet_fundamentals.asp
> > > > > http://www.takempis.com/aspnet_controls.asp
> > > > > http://www.takempis.com/aspnet_anatomy1.asp
> > > > > http://www.takempis.com/aspnet_anatomy2.asp
> > > > > http://www.takempis.com/aspnet_anatomy3.asp
> > > > >
> > > > > --
> > > > > HTH,
> > > > > Kevin Spencer
> > > > > .Net Developer
> > > > > Microsoft MVP
> > > > > Big things are made up
> > > > > of lots of little things.
> > > > >
> > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com>

wrote
in
> > > > message
> > > > > news:ua**************@TK2MSFTNGP10.phx.gbl...
> > > > > > OK, lets try this one more time.
> > > > > >
> > > > > > A custom control allows you to present itself any way you

choose
> > > > rendering
> > > > > > HTML. In the custom control I was writing, I simply wanted a
> number
> > > of
> > > > > text
> > > > > > boxes to return their data and persist in viewstate.
> > > > > >
> > > > > > In order to facilitate this your control must implement
the > > > > > > IPostBackDataCollection interface. However, the following
function
> > > > returns
> > > > > > all the postback data from the web forms and allows you to
get the
> > > data
> > > > > > specifically for your custom control.
> > > > > > Public Function LoadPostData(ByVal postDataKey As String,

ByVal
> > > > > > postCollection As
> > System.Collections.Specialized.NameValueCollection )
> > > As
> > > > > > Boolean Implements
System.Web.UI.IPostBackDataHandler.LoadPostData
> > > > > >
> > > > > > BUT. . . If you examine the returned value for your cc, this is
> > simply
> > > a
> > > > > > number of string values for the elements of the control .
> > > > > >
> > > > > > My question was this. Does a slicker way exist to get
these values
> > in
> > > a
> > > > > > value/pair collection or do we have to resort to adding hidden > html
> > > > fields
> > > > > > so that we can store the FieldName as well as the values.
> remember,
> > > > > ASP.NET
> > > > > > does not know about the controls within the CC.
> > > > > >
> > > > > > Hope this explains a aliitle better
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > OHM ( Terry Burns )
> > > > > > . . . One-Handed-Man . . .
> > > > > >
> > > > > >
> > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > Well that would be me.
> > > > > > > >
> > > > > > > > My question is one of concept, not regarding the

particular
> > > control
> > > > in
> > > > > > > > question.
> > > > > > >
> > > > > > > In that case, can you tell us what you mean by "the values > > returned
> > > by
> > > > > the
> > > > > > > Controls"? A Control is a class, and doesn't return a value. I'm
> > > sure
> > > > > you
> > > > > > > mean something by this, but I can't figure out what.
> > > > > > >
> > > > > > > --
> > > > > > > HTH,
> > > > > > > Kevin Spencer
> > > > > > > .Net Developer
> > > > > > > Microsoft MVP
> > > > > > > Big things are made up
> > > > > > > of lots of little things.
> > > > > > >
> > > > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> > wrote
> > in
> > > > > > message
> > > > > > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > Well that would be me.
> > > > > > > >
> > > > > > > > My question is one of concept, not regarding the

particular
> > > control
> > > > in
> > > > > > > > question.
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > OHM ( Terry Burns )
> > > > > > > > . . . One-Handed-Man . . .
> > > > > > > >
> > > > > > > >
> > > > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message > > > > > > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > Only the person who developed the custom Control can
answer
> > this
> > > > > > > question.
> > > > > > > > > We don't have the source code.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > HTH,
> > > > > > > > > Kevin Spencer
> > > > > > > > > .Net Developer
> > > > > > > > > Microsoft MVP
> > > > > > > > > Big things are made up
> > > > > > > > > of lots of little things.
> > > > > > > > >
> > > > > > > > > "One Handed Man ( OHM - Terry Burns )"
<news.microsoft.com>
> > > wrote
> > > > in
> > > > > > > > message
> > > > > > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > When using a custom control. In order to check and see if
> > > values
> > > > > > have
> > > > > > > > > > changed one has to implement the

IPostBackDataCollection
> > > > > interface.
> > > > > > > The
> > > > > > > > > > values returned for the control seem to be simply a string
> > > with
> > > > > > comma
> > > > > > > > > > delimited values.
> > > > > > > > > >
> > > > > > > > > > For example, if I were to render two text boxes. One with
> > the
> > > > > Value
> > > > > > > > Terry
> > > > > > > > > > and the Other with the Value 'Burns' I would get the > > following
> > > > > value
> > > > > > > > > >
> > > > > > > > > > Terry,Burns.
> > > > > > > > > >
> > > > > > > > > > I need this to be more like this
> > > > > > > > > >
> > > > > > > > > > Forname,Terry,Surname,Burns. So I get get this
into a > > > key/Pair
> > > > > > > > > collection.
> > > > > > > > > >
> > > > > > > > > > Is there something Im missing here, as I'm not

sure how
I
> > can
> > > do
> > > > > > this.
> > > > > > > I
> > > > > > > > > > tried rendering and ID name to see if this would
generate
> > this
> > > > > > effect,
> > > > > > > > but
> > > > > > > > > > it caused the event not to fire.
> > > > > > > > > >
> > > > > > > > > > Any Ideas would be welcome.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > > > > > > OHM ( Terry Burns )
> > > > > > > > > > . . . One-Handed-Man . . .
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #16

P: n/a
OK, typo, by you know what I meant dont you ?

Tell you what Kevin, I'll go figure this for myself. Thanks for your help
anyways !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
The id attribute is not the name attribute.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:O4**************@TK2MSFTNGP11.phx.gbl...
No, they are not the same name. My Senario . . .

--- MY Custom Control -- - -

<Input id=txtName . . . . . value="MyFirstName">
<Input id=txtAddress . . . . .value="MyAddress">

--------------------------------
The output from the control ( value ) in the PostBackCollection(MyControlID)
is

"MyFirstName,MyAddress"



--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I'mnot following you there, Terry. However, I CAN tell you that having a single Control having multiple form fields in it with the same name
attribute is a mistake, as the rules of HTML is not something Microsoft
has
any control over.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
> Hi Kevin, Thanks for coming back on this one.
>
> Yes, correct !
>
> Now, we have arrived at the understanding, the question is that I
was hoping
> that this data could be represented as value/key pairs. To better
illustrate
> what I mean, lets say we take this string and split it and make use of
its
> elements in our code on the host form.
>
> What if we need to change the layout of our custom control ?, this means we
> have to go back and re-jig the code. If however, we could arrange things so
> that the ID of the Field allways preceeded the value, we could
create a > collection of key/Value pairs in their own right, thus freeing us
from the
> concerns about layout and modifications.
>
> And thats what I'm after !
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
>
> "Kevin Spencer" <ks******@takempis.com> wrote in message
> news:ec**************@TK2MSFTNGP10.phx.gbl...
> > The PostDataCollection is simply a Collection of the form field
data > posted
> > by the client form. HTML Form data is posted using name=value pairs. If
a
> > single entry (PostDataCollection(PostDataKey) is a single entry)
contains
> > more than one value, delimited by one or more commas, it contains the > values
> > of more than one form field having the same name attribute on the
client.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in > message
> > news:uf**************@TK2MSFTNGP09.phx.gbl...
> > > kevin,
> > > I do appreciate your help here, but we seem to have
some kind
> > of
> > > disconnect. Either I am functionally inoperative or we simply dont > > > understand each other.
> > >
> > > PostDataCollection(PostDataKey) returns the CustomControl data. This is
> > just
> > > a string of concatenated strings.
> > >
> > > --
> > >
> > > OHM ( Terry Burns )
> > > . . . One-Handed-Man . . .
> > >
> > >
> > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > news:e%***************@TK2MSFTNGP11.phx.gbl...
> > > > If you have 2 textboxes coming into the PostDataCollection as a single
> > > > comma-delimited item, they must have the same "name" attribute on the
> > > > client. The HTML form posts the data in the form as name/value
pairs,
> > > using
> > > > the "name" attribute of the client-side form field to link the

data
> with
> > > the
> > > > form field on the client.
> > > >
> > > > --
> > > > HTH,
> > > > Kevin Spencer
> > > > .Net Developer
> > > > Microsoft MVP
> > > > Big things are made up
> > > > of lots of little things.
> > > >
> > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in
> > > message
> > > > news:#Y**************@TK2MSFTNGP11.phx.gbl...
> > > > > No no, I'm not refering to the Return value of the function , I'm
> > > refering
> > > > > to the values passed TO the function which contain the data for the
> > > > control.
> > > > >
> > > > > postCollection(PostDataKey) is passed, the key is the ID of the > > control
> > > > and
> > > > > the data value in the collection is a string containing the HTML > > element
> > > > > values. So if you have two text boxes with values of Me and You, > then
> > > > > returned is "Me,You"
> > > > >
> > > > > Now do you see what Im driving at ?
> > > > >
> > > > > --
> > > > >
> > > > > OHM ( Terry Burns )
> > > > > . . . One-Handed-Man . . .
> > > > >
> > > > >
> > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > news:Oo**************@TK2MSFTNGP10.phx.gbl...
> > > > > > Actually, that function returns a boolean value, either
True or
> > False.
> > > > > > Again, I'm having some trouble understanding your
question. > However,
> > I
> > > > > have
> > > > > > written some articles on developing custom Server Controls, which
> > may
> > > > > help:
> > > > > >
> > > > > > http://www.takempis.com/aspnet_fundamentals.asp
> > > > > > http://www.takempis.com/aspnet_controls.asp
> > > > > > http://www.takempis.com/aspnet_anatomy1.asp
> > > > > > http://www.takempis.com/aspnet_anatomy2.asp
> > > > > > http://www.takempis.com/aspnet_anatomy3.asp
> > > > > >
> > > > > > --
> > > > > > HTH,
> > > > > > Kevin Spencer
> > > > > > .Net Developer
> > > > > > Microsoft MVP
> > > > > > Big things are made up
> > > > > > of lots of little things.
> > > > > >
> > > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
> in
> > > > > message
> > > > > > news:ua**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > OK, lets try this one more time.
> > > > > > >
> > > > > > > A custom control allows you to present itself any way you choose
> > > > > rendering
> > > > > > > HTML. In the custom control I was writing, I simply

wanted
a
> > number
> > > > of
> > > > > > text
> > > > > > > boxes to return their data and persist in viewstate.
> > > > > > >
> > > > > > > In order to facilitate this your control must implement

the > > > > > > > IPostBackDataCollection interface. However, the following > function
> > > > > returns
> > > > > > > all the postback data from the web forms and allows you to get
> the
> > > > data
> > > > > > > specifically for your custom control.
> > > > > > > Public Function LoadPostData(ByVal postDataKey As
String, ByVal
> > > > > > > postCollection As
> > > System.Collections.Specialized.NameValueCollection )
> > > > As
> > > > > > > Boolean Implements
> System.Web.UI.IPostBackDataHandler.LoadPostData
> > > > > > >
> > > > > > > BUT. . . If you examine the returned value for your cc, this is
> > > simply
> > > > a
> > > > > > > number of string values for the elements of the control .. > > > > > > >
> > > > > > > My question was this. Does a slicker way exist to get these > values
> > > in
> > > > a
> > > > > > > value/pair collection or do we have to resort to adding

hidden
> > html
> > > > > fields
> > > > > > > so that we can store the FieldName as well as the values. > > remember,
> > > > > > ASP.NET
> > > > > > > does not know about the controls within the CC.
> > > > > > >
> > > > > > > Hope this explains a aliitle better
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > OHM ( Terry Burns )
> > > > > > > . . . One-Handed-Man . . .
> > > > > > >
> > > > > > >
> > > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > > > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > Well that would be me.
> > > > > > > > >
> > > > > > > > > My question is one of concept, not regarding the
particular
> > > > control
> > > > > in
> > > > > > > > > question.
> > > > > > > >
> > > > > > > > In that case, can you tell us what you mean by "the values > > > returned
> > > > by
> > > > > > the
> > > > > > > > Controls"? A Control is a class, and doesn't return a

value.
> I'm
> > > > sure
> > > > > > you
> > > > > > > > mean something by this, but I can't figure out what.
> > > > > > > >
> > > > > > > > --
> > > > > > > > HTH,
> > > > > > > > Kevin Spencer
> > > > > > > > .Net Developer
> > > > > > > > Microsoft MVP
> > > > > > > > Big things are made up
> > > > > > > > of lots of little things.
> > > > > > > >
> > > > > > > > "One Handed Man ( OHM - Terry Burns )"

<news.microsoft.com>
> > wrote
> > > in
> > > > > > > message
> > > > > > > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > Well that would be me.
> > > > > > > > >
> > > > > > > > > My question is one of concept, not regarding the
particular
> > > > control
> > > > > in
> > > > > > > > > question.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > OHM ( Terry Burns )
> > > > > > > > > . . . One-Handed-Man . . .
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message > > > > > > > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > Only the person who developed the custom Control can > answer
> > > this
> > > > > > > > question.
> > > > > > > > > > We don't have the source code.
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > HTH,
> > > > > > > > > > Kevin Spencer
> > > > > > > > > > .Net Developer
> > > > > > > > > > Microsoft MVP
> > > > > > > > > > Big things are made up
> > > > > > > > > > of lots of little things.
> > > > > > > > > >
> > > > > > > > > > "One Handed Man ( OHM - Terry Burns )"
> <news.microsoft.com>
> > > > wrote
> > > > > in
> > > > > > > > > message
> > > > > > > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > > When using a custom control. In order to check
and see
> if
> > > > values
> > > > > > > have
> > > > > > > > > > > changed one has to implement the
IPostBackDataCollection
> > > > > > interface.
> > > > > > > > The
> > > > > > > > > > > values returned for the control seem to be

simply a > string
> > > > with
> > > > > > > comma
> > > > > > > > > > > delimited values.
> > > > > > > > > > >
> > > > > > > > > > > For example, if I were to render two text boxes. One > with
> > > the
> > > > > > Value
> > > > > > > > > Terry
> > > > > > > > > > > and the Other with the Value 'Burns' I would get the > > > following
> > > > > > value
> > > > > > > > > > >
> > > > > > > > > > > Terry,Burns.
> > > > > > > > > > >
> > > > > > > > > > > I need this to be more like this
> > > > > > > > > > >
> > > > > > > > > > > Forname,Terry,Surname,Burns. So I get get this into
a
> > > > key/Pair
> > > > > > > > > > collection.
> > > > > > > > > > >
> > > > > > > > > > > Is there something Im missing here, as I'm not

sure how
> I
> > > can
> > > > do
> > > > > > > this.
> > > > > > > > I
> > > > > > > > > > > tried rendering and ID name to see if this would
> generate
> > > this
> > > > > > > effect,
> > > > > > > > > but
> > > > > > > > > > > it caused the event not to fire.
> > > > > > > > > > >
> > > > > > > > > > > Any Ideas would be welcome.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > > > > > > > OHM ( Terry Burns )
> > > > > > > > > > > . . . One-Handed-Man . . .
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #17

P: n/a
Sorry, OHM, I don't know what anyone means except what they say. Too many
years programming, I suppose. Best of luck to you!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:#M**************@TK2MSFTNGP12.phx.gbl...
OK, typo, by you know what I meant dont you ?

Tell you what Kevin, I'll go figure this for myself. Thanks for your help
anyways !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
The id attribute is not the name attribute.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
No, they are not the same name. My Senario . . .

--- MY Custom Control -- - -

<Input id=txtName . . . . . value="MyFirstName">
<Input id=txtAddress . . . . .value="MyAddress">

--------------------------------
The output from the control ( value ) in the

PostBackCollection(MyControlID)
is

"MyFirstName,MyAddress"



--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> I'mnot following you there, Terry. However, I CAN tell you that having a
> single Control having multiple form fields in it with the same name
> attribute is a mistake, as the rules of HTML is not something Microsoft has
> any control over.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
> news:Oc**************@TK2MSFTNGP11.phx.gbl...
> > Hi Kevin, Thanks for coming back on this one.
> >
> > Yes, correct !
> >
> > Now, we have arrived at the understanding, the question is that I was > hoping
> > that this data could be represented as value/key pairs. To better
> illustrate
> > what I mean, lets say we take this string and split it and make
use
of its
> > elements in our code on the host form.
> >
> > What if we need to change the layout of our custom control ?, this means
> we
> > have to go back and re-jig the code. If however, we could arrange

things
> so
> > that the ID of the Field allways preceeded the value, we could create
a
> > collection of key/Value pairs in their own right, thus freeing us from the
> > concerns about layout and modifications.
> >
> > And thats what I'm after !
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> >
> > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > news:ec**************@TK2MSFTNGP10.phx.gbl...
> > > The PostDataCollection is simply a Collection of the form field data > > posted
> > > by the client form. HTML Form data is posted using name=value pairs. If
> a
> > > single entry (PostDataCollection(PostDataKey) is a single entry)
> contains
> > > more than one value, delimited by one or more commas, it
contains the
> > values
> > > of more than one form field having the same name attribute on
the > client.
> > >
> > > --
> > > HTH,
> > > Kevin Spencer
> > > .Net Developer
> > > Microsoft MVP
> > > Big things are made up
> > > of lots of little things.
> > >
> > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in > > message
> > > news:uf**************@TK2MSFTNGP09.phx.gbl...
> > > > kevin,
> > > > I do appreciate your help here, but we seem to have some
> kind
> > > of
> > > > disconnect. Either I am functionally inoperative or we simply dont > > > > understand each other.
> > > >
> > > > PostDataCollection(PostDataKey) returns the CustomControl
data. This
> is
> > > just
> > > > a string of concatenated strings.
> > > >
> > > > --
> > > >
> > > > OHM ( Terry Burns )
> > > > . . . One-Handed-Man . . .
> > > >
> > > >
> > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > news:e%***************@TK2MSFTNGP11.phx.gbl...
> > > > > If you have 2 textboxes coming into the PostDataCollection
as a > single
> > > > > comma-delimited item, they must have the same "name"
attribute on
> the
> > > > > client. The HTML form posts the data in the form as
name/value > pairs,
> > > > using
> > > > > the "name" attribute of the client-side form field to link the data
> > with
> > > > the
> > > > > form field on the client.
> > > > >
> > > > > --
> > > > > HTH,
> > > > > Kevin Spencer
> > > > > .Net Developer
> > > > > Microsoft MVP
> > > > > Big things are made up
> > > > > of lots of little things.
> > > > >
> > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote
in
> > > > message
> > > > > news:#Y**************@TK2MSFTNGP11.phx.gbl...
> > > > > > No no, I'm not refering to the Return value of the function , I'm
> > > > refering
> > > > > > to the values passed TO the function which contain the
data for
> the
> > > > > control.
> > > > > >
> > > > > > postCollection(PostDataKey) is passed, the key is the ID
of the
> > > control
> > > > > and
> > > > > > the data value in the collection is a string containing
the HTML
> > > element
> > > > > > values. So if you have two text boxes with values of Me
and You,
> > then
> > > > > > returned is "Me,You"
> > > > > >
> > > > > > Now do you see what Im driving at ?
> > > > > >
> > > > > > --
> > > > > >
> > > > > > OHM ( Terry Burns )
> > > > > > . . . One-Handed-Man . . .
> > > > > >
> > > > > >
> > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message
> > > > > > news:Oo**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > Actually, that function returns a boolean value, either True or
> > > False.
> > > > > > > Again, I'm having some trouble understanding your question. > > However,
> > > I
> > > > > > have
> > > > > > > written some articles on developing custom Server Controls, > which
> > > may
> > > > > > help:
> > > > > > >
> > > > > > > http://www.takempis.com/aspnet_fundamentals.asp
> > > > > > > http://www.takempis.com/aspnet_controls.asp
> > > > > > > http://www.takempis.com/aspnet_anatomy1.asp
> > > > > > > http://www.takempis.com/aspnet_anatomy2.asp
> > > > > > > http://www.takempis.com/aspnet_anatomy3.asp
> > > > > > >
> > > > > > > --
> > > > > > > HTH,
> > > > > > > Kevin Spencer
> > > > > > > .Net Developer
> > > > > > > Microsoft MVP
> > > > > > > Big things are made up
> > > > > > > of lots of little things.
> > > > > > >
> > > > > > > "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> > wrote
> > in
> > > > > > message
> > > > > > > news:ua**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > OK, lets try this one more time.
> > > > > > > >
> > > > > > > > A custom control allows you to present itself any way you > choose
> > > > > > rendering
> > > > > > > > HTML. In the custom control I was writing, I simply wanted
a
> > > number
> > > > > of
> > > > > > > text
> > > > > > > > boxes to return their data and persist in viewstate.
> > > > > > > >
> > > > > > > > In order to facilitate this your control must
implement the
> > > > > > > > IPostBackDataCollection interface. However, the following > > function
> > > > > > returns
> > > > > > > > all the postback data from the web forms and allows
you to get
> > the
> > > > > data
> > > > > > > > specifically for your custom control.
> > > > > > > > Public Function LoadPostData(ByVal postDataKey As String, > ByVal
> > > > > > > > postCollection As
> > > > System.Collections.Specialized.NameValueCollection )
> > > > > As
> > > > > > > > Boolean Implements
> > System.Web.UI.IPostBackDataHandler.LoadPostData
> > > > > > > >
> > > > > > > > BUT. . . If you examine the returned value for your
cc, this
> is
> > > > simply
> > > > > a
> > > > > > > > number of string values for the elements of the
control
. > > > > > > > >
> > > > > > > > My question was this. Does a slicker way exist to get

these
> > values
> > > > in
> > > > > a
> > > > > > > > value/pair collection or do we have to resort to
adding hidden
> > > html
> > > > > > fields
> > > > > > > > so that we can store the FieldName as well as the

values. > > > remember,
> > > > > > > ASP.NET
> > > > > > > > does not know about the controls within the CC.
> > > > > > > >
> > > > > > > > Hope this explains a aliitle better
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > OHM ( Terry Burns )
> > > > > > > > . . . One-Handed-Man . . .
> > > > > > > >
> > > > > > > >
> > > > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in message > > > > > > > > news:up*************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > Well that would be me.
> > > > > > > > > >
> > > > > > > > > > My question is one of concept, not regarding the
> particular
> > > > > control
> > > > > > in
> > > > > > > > > > question.
> > > > > > > > >
> > > > > > > > > In that case, can you tell us what you mean by "the

values
> > > > returned
> > > > > by
> > > > > > > the
> > > > > > > > > Controls"? A Control is a class, and doesn't return a value.
> > I'm
> > > > > sure
> > > > > > > you
> > > > > > > > > mean something by this, but I can't figure out what.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > HTH,
> > > > > > > > > Kevin Spencer
> > > > > > > > > .Net Developer
> > > > > > > > > Microsoft MVP
> > > > > > > > > Big things are made up
> > > > > > > > > of lots of little things.
> > > > > > > > >
> > > > > > > > > "One Handed Man ( OHM - Terry Burns )"
<news.microsoft.com>
> > > wrote
> > > > in
> > > > > > > > message
> > > > > > > > > news:#w**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > Well that would be me.
> > > > > > > > > >
> > > > > > > > > > My question is one of concept, not regarding the
> particular
> > > > > control
> > > > > > in
> > > > > > > > > > question.
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > > > > > > OHM ( Terry Burns )
> > > > > > > > > > . . . One-Handed-Man . . .
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > "Kevin Spencer" <ks******@takempis.com> wrote in

message
> > > > > > > > > > news:e7**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > > Only the person who developed the custom Control can > > answer
> > > > this
> > > > > > > > > question.
> > > > > > > > > > > We don't have the source code.
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > HTH,
> > > > > > > > > > > Kevin Spencer
> > > > > > > > > > > .Net Developer
> > > > > > > > > > > Microsoft MVP
> > > > > > > > > > > Big things are made up
> > > > > > > > > > > of lots of little things.
> > > > > > > > > > >
> > > > > > > > > > > "One Handed Man ( OHM - Terry Burns )"
> > <news.microsoft.com>
> > > > > wrote
> > > > > > in
> > > > > > > > > > message
> > > > > > > > > > > news:OA**************@TK2MSFTNGP10.phx.gbl...
> > > > > > > > > > > > When using a custom control. In order to check and see
> > if
> > > > > values
> > > > > > > > have
> > > > > > > > > > > > changed one has to implement the
> IPostBackDataCollection
> > > > > > > interface.
> > > > > > > > > The
> > > > > > > > > > > > values returned for the control seem to be

simply
a
> > string
> > > > > with
> > > > > > > > comma
> > > > > > > > > > > > delimited values.
> > > > > > > > > > > >
> > > > > > > > > > > > For example, if I were to render two text boxes. One
> > with
> > > > the
> > > > > > > Value
> > > > > > > > > > Terry
> > > > > > > > > > > > and the Other with the Value 'Burns' I would
get the
> > > > following
> > > > > > > value
> > > > > > > > > > > >
> > > > > > > > > > > > Terry,Burns.
> > > > > > > > > > > >
> > > > > > > > > > > > I need this to be more like this
> > > > > > > > > > > >
> > > > > > > > > > > > Forname,Terry,Surname,Burns. So I get get
this into
a
> > > > > key/Pair
> > > > > > > > > > > collection.
> > > > > > > > > > > >
> > > > > > > > > > > > Is there something Im missing here, as I'm not

sure
> how
> > I
> > > > can
> > > > > do
> > > > > > > > this.
> > > > > > > > > I
> > > > > > > > > > > > tried rendering and ID name to see if this

would > > generate
> > > > this
> > > > > > > > effect,
> > > > > > > > > > but
> > > > > > > > > > > > it caused the event not to fire.
> > > > > > > > > > > >
> > > > > > > > > > > > Any Ideas would be welcome.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > > > > > > > OHM ( Terry Burns )
> > > > > > > > > > > > . . . One-Handed-Man . . .
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #18

P: n/a
The name attribute is used by the client, and is posted back to the server
by the client. The id attribute is used on the server to uniquely identify
the Control. Again, it is a mistake to create a Custom Server Control that
always has the same name attribute on the client, for the very reason that
we've been going round and round about. As this is a Custom Server Control,
you, the developer, are fully in charge of how it renders on the client.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Jeff Evans" <Jeff Ev***@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
"One Handed Man ( OHM - Terry Burns )" wrote:
OK, typo, by you know what I meant dont you ?

Tell you what Kevin, I'll go figure this for myself. Thanks for your help anyways !
I've been following this thread and I think I know exactly what you're

talking about. I have the same problem. To outline my understanding of the
issue here:
You have a custom control, called MyControl. You want to implement IPostBackDataHandler for this control, so that it make use of LoadPostData
and possibly RaisePostDataChangedEvent. The problem is, these events will
only be called if the runtime finds something in the form with the "name"
attribute matching the UniqueID of this instantiation of the control
MyControl. This could be something like (in my present case) "_ct10".
Fine, but what if we want to post *multiple* values with this control, and
have potentially multiple "postDataKey" values for the same control? Is
this even possible? Is there a better way to handle this than splitting the
returned value for postCollection["_ct10"] by a comma (clearly this is a
problem if submitted values HAVE commas themselves)?
Let's go back to the example you mentioned some time ago with:
<Input id=txtName . . . . . value="MyFirstName">
<Input id=txtAddress . . . . .value="MyAddress">

Now for both of these inputs to have their values properly received in the LoadPostData of the form, on submit, they would have to be assigned the same
"name" attribute (say, "_ct10"), correct? This is the only way the runtime
knows *this* data was intended for *this* control. But this of course poses
a problem, as we've already seen.
what is the proper way of submitting multiple form values for the same custom control, and having each one properly resolve itself in LoadPostData?
Is it even possible? (Come to think of it, the only examples I've seen of
this in use are somewhat trivial cases with just one input).
Any help is appreciated, and OHM, I'll let you know if I discover

anything. Thanks!
Nov 18 '05 #19

P: n/a
BTW, here is an excellent and comprehensive reference on the Microsoft MSDN
Library, which you can study in case you haven't downloaded the free .Net
SDK:

http://msdn.microsoft.com/library/en...asp?frame=true

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Jeff Evans" <Jeff Ev***@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
"One Handed Man ( OHM - Terry Burns )" wrote:
OK, typo, by you know what I meant dont you ?

Tell you what Kevin, I'll go figure this for myself. Thanks for your help anyways !
I've been following this thread and I think I know exactly what you're

talking about. I have the same problem. To outline my understanding of the
issue here:
You have a custom control, called MyControl. You want to implement IPostBackDataHandler for this control, so that it make use of LoadPostData
and possibly RaisePostDataChangedEvent. The problem is, these events will
only be called if the runtime finds something in the form with the "name"
attribute matching the UniqueID of this instantiation of the control
MyControl. This could be something like (in my present case) "_ct10".
Fine, but what if we want to post *multiple* values with this control, and
have potentially multiple "postDataKey" values for the same control? Is
this even possible? Is there a better way to handle this than splitting the
returned value for postCollection["_ct10"] by a comma (clearly this is a
problem if submitted values HAVE commas themselves)?
Let's go back to the example you mentioned some time ago with:
<Input id=txtName . . . . . value="MyFirstName">
<Input id=txtAddress . . . . .value="MyAddress">

Now for both of these inputs to have their values properly received in the LoadPostData of the form, on submit, they would have to be assigned the same
"name" attribute (say, "_ct10"), correct? This is the only way the runtime
knows *this* data was intended for *this* control. But this of course poses
a problem, as we've already seen.
what is the proper way of submitting multiple form values for the same custom control, and having each one properly resolve itself in LoadPostData?
Is it even possible? (Come to think of it, the only examples I've seen of
this in use are somewhat trivial cases with just one input).
Any help is appreciated, and OHM, I'll let you know if I discover

anything. Thanks!
Nov 18 '05 #20

P: n/a
> BTW, here is an excellent and comprehensive reference on the Microsoft MSDN
Library, which you can study in case you haven't downloaded the free .Net
SDK:

http://msdn.microsoft.com/library/en...asp?frame=true


That is an excellent resource I haven't run across yet, thank you. It clarifies a lot of things. I just have one more question, that isn't even really important to development. Does the NameValueCollection "values" (or whatever you call it) that is a parameter to LoadPostData() contain *all* the key/value pairs for the entire page (entire form), and not just those associated with the control on which the method is called? That's the impression I get from reading the "Composition vs. Rendering" article at:

http://msdn.microsoft.com/library/de...srendering.asp

If so, does that mean that in the LoadPostData for, say, MyControl, you could potentially read key/value pairs intended for other controls? Just curious. Thank you for your time.
Nov 18 '05 #21

P: n/a
Hi Jeff,

Remember that ASP.Net is a means of working with and rendering HTML. If you
understand how HTML works, you've got half of ASP.Net figured out (the easy
half!). A PostBack is simply an HTML form posting itself to the same URL it
came from, and the server-side objects handle the Request. In HTML, a form
posts all form fields contained within it, including hidden form fields. So,
the answer to your very good question is, The PostDataCollection is a
NameValueCollection (object) which is formed by getting all the names and
all the values posted by the form, and putting them into this Collection.
The postDataKey parameter is the name of the form field which caused the
Post. It is obtained by checking the hidden __EventTarget form field which
ASP.Net adds to the form. It uses JavaScript on the client to set the value
of this hidden form field and posting the form. As long as you knew the
client-side name attribute of any form field, you could extract its value by
invoking postCollection["FormFieldName"].

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Jeff Evans" <Je*******@discussions.microsoft.com> wrote in message
news:EC**********************************@microsof t.com...
BTW, here is an excellent and comprehensive reference on the Microsoft MSDN Library, which you can study in case you haven't downloaded the free ..Net SDK:
http://msdn.microsoft.com/library/en...asp?frame=true
That is an excellent resource I haven't run across yet, thank you. It clarifies a lot of things. I just have one more question, that isn't even
really important to development. Does the NameValueCollection "values" (or
whatever you call it) that is a parameter to LoadPostData() contain *all*
the key/value pairs for the entire page (entire form), and not just those
associated with the control on which the method is called? That's the
impression I get from reading the "Composition vs. Rendering" article at:
http://msdn.microsoft.com/library/de...srendering.asp
If so, does that mean that in the LoadPostData for, say, MyControl, you

could potentially read key/value pairs intended for other controls? Just
curious. Thank you for your time.
Nov 18 '05 #22

This discussion thread is closed

Replies have been disabled for this discussion.