Hi all,
I have a loop in my code which builds the controls on the page.
I at one stage need to add some hidden input controls dynamically, I have
achieved this, and I have set their properties, however, there seems to be
one that I cannot set - ie, Name..
My code looks like this:
' loop starts here
' set hidden control properties
hidDataItem.Attributes("name") = intLoop
hidDataItem.Attributes("id") =
m_params.GetParameterByIndex(intLoop).m_objectName
hidDataItem.Attributes("value") =
m_params.GetParameterByIndex(intLoop).m_queryStrin gData
panelForm.Controls.Add(hidDataItem)
' loop ends here
The results look like this:
<input name="_ctl1" type="hidden" id="hidRID" value="B6xky" /><input
name="_ctl10" type="hidden" id="hidHospital" value="BRI" />
Whilst the ID and Value properties are the only ones I'll be interested in
later, ie, when the form is submitted, its making me wonder why it is that I
am unable to set the name property.
I've tried having
"name" = m_params.GetParameterByIndex(intLoop).m_objectName
when it didnt work I thought - hmm, maybe it doesn't like having an ID and a
Name that are equal (odd I know - as it'll only render HTML) but I changed
it anyway....so currently set to intLoop...
Its almost as if the 'name' property is written before you get to set
anything and thus defaults to _ctl1, _ctl2 and so on..
Any info on this one would be appreciated, as I say I can still get the form
to do what I need it to do - so no real biggy - I'd just like to understand
'why' it doesn't let me set its value.
Thanks in advance.
Regards
Rob