Your loop or FindControl() should find the controls and their values just
fine since you're creating them in PageLoad.
I'm sorry I didn't notice this earlier but one thing to note is that each
control uses a different property to access the value it contains.
TextBoxes for instance, use the Text property.
CheckBoxes and RadioButtons are a little more tricky though because they
don't have a "value" property despite the presence of one in HTML. The
"value" of a check box or radio button is "Checked" or "Unchecked" and is
implemented through the boolean Checked property.
To overcome the limitation of the CheckBoxes and RadioButtons, you could
derive a new control from the CheckBox and RadioButton classes called
ValuedCheckBox or ValuedRadioButton respectively and add a Value property OR
you could fall back on the trusty Request.Forms collection.
Now, keeping this all in mind, in order to retrieve the value for the
controls, you'll need to convert the control to the appropriate type since
the property won't be accessible through the Control class. I'm not a VB
expert but you'll accomplish the conversion using the CType command if I'm
not mistaken. Obviously, you'll need to test for the type before you do the
conversion and call the appropriate code for the type. I'm sure there's a
VB shortcut for the test but you could use Object.ReferenceEquals if you
need something quick.
HTH
----------------
Dave Fancher
http://www.davefancher.com
"Kezza" <Ke***@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
Thanks Dave
Are you saying that my loop
for each xcontrol in xPanels.controls
response.write me(xControl).Value
Next
and syntax should work, if I have declared the controls early enough.
I am creating them on pageload by the way.
Thanks
Kez.
"Dave Fancher" wrote:
Depending on when you create the controls, their state may not be updated
to
reflect any client-side changes. You could either move the creation of
the
controls earlier in the page's life cycle or use Request.Form.
You may want to read
http://msdn.microsoft.com/library/de...bjectmodel.asp
for more information about how/when control state is updated.
FindControl should be able to get you a reference to the control but
again,
it depends on when you call FindControl and when you create the controls.
HTH
----------------
Dave Fancher
http://www.davefancher.com
"Kezza" <Ke***@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com... > Hi There..
> I have dynamically created some textbox and checkbox controls by adding
> them
> to a panel. Now I would like to get the values out.
> I have created a
> for each loop that I can see the controls Unique ID with. But I for
> the
> life of me can't figure out how to see the value the control is
> storing.
> Could somebody please help me. I'm thinking that I might need to use
> something like "findcontrol", but this wouldn't make sense to me.
>
> This is what I would ideally like.
> for each xcontrol in xPanels.controls
> response.write me(xControl).Value
> Next
>
> But this doesn't seem to work.
> Many Thanks for some help.
> Kez.