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.Att ributes("name") = intLoop
hidDataItem.Att ributes("id") =
m_params.GetPar ameterByIndex(i ntLoop).m_objec tName
hidDataItem.Att ributes("value" ) =
m_params.GetPar ameterByIndex(i ntLoop).m_query StringData
panelForm.Contr ols.Add(hidData Item)
' 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.GetPar ameterByIndex(i ntLoop).m_objec tName
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 1 2381
its much simpler to use RegisterHiddenF ield for this purpose.
anyway your problem is that you are setting the attributes instead of the
control property Id. To implement postback, the control makes the name
attribute match its ID (serverside), so you can not override the name. you
can override the id attribute, because it is not posted back, and has no
effect on server processing.
-- bruce (sqlwork.com)
"Rob Meade" <ro**********@N OSPAMubht.swest .nhs.uk> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l... 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.Att ributes("name") = intLoop hidDataItem.Att ributes("id") = m_params.GetPar ameterByIndex(i ntLoop).m_objec tName hidDataItem.Att ributes("value" ) = m_params.GetPar ameterByIndex(i ntLoop).m_query StringData panelForm.Contr ols.Add(hidData Item)
' 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.GetPar ameterByIndex(i ntLoop).m_objec tName
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: J Krugman |
last post by:
I have a form with a couple of submit buttons, plus a "pseudolink"
that is also supposed to submit the form; the submitted form data
feeds to a CGI script. The two submit buttons have the name
"go_for_it", so that when the form is submitted, the CGI script
looks for the value of the CGI parameter "go_for_it". I want the
pseudolink to set the value of this CGI parameter prior to submitting
the form, but I can't get it to work. Here's the...
|
by: Dixie |
last post by:
Can I set the Format property in a date/time field in code?
Can I set the Input Mask in a date/time field in code?
Can I set the Format of a Yes/No field to Checkbox in code?
I am working on a remote update of tables and fields and can't find enough
information on these things.
Also, how do you index a field in code?
|
by: Andy Fish |
last post by:
Hi,
I want to generate a value with javascript and include it in the form
postback for a web form.
based on my previous web development experience, I think I need an <input
type=hidden> on the page. However, to fit in properly with the web forms
paradigm, I would like this to be a proper asp.net server side control
rather than just generating it in the HTML.
|
by: Andre Ranieri |
last post by:
I'm trying to create a login page for customers to log into our corporate
website, our presidents naturally wants the user and password fields to
populate from a cookie so the customer doesn't have to type their credentials
every time, this seems like a pretty common thing. However, when I try to
populate the password HTML textbox from the cookie, the textbox remains
blank. However, if I try this from an equivalent web control, the...
|
by: Paul |
last post by:
I want to set the page title and/or a form hidden field programatically
through ASP.Net.
I do not want to use something like...
<% sTitle ="My Title" %>
<html><title><%=sTitle%></title>.....
I want to completely seperate the code from presentation.
I would like to do the same thing for a value of a hidden form field but
| |
by: WB |
last post by:
Hi,
I need to validate a hidden input in my webform to ensure that it's got
value. The controls look something like this:
<input id="HidSelectedStates" type="hidden" runat="server" /><br /><br />
<asp:Button ID="BtnSubmit" runat="server" OnClick="BtnSubmit_Click"
Text="Submit" ValidationGroup="submitStates" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: newbie |
last post by:
i have a form in which a hidden field (initial value as '0', and my
javascript set it to '1' when an event is trigged).
In the same form, i have a reset field. But I realized that the hidden
field is not reset to '0' when i push the
reset button. If I simply change the node from
"<input type="hidden" id='IsChanged' value='0'>"
to
"<input type="text" id='IsChanged' value='0'>"
Everything is working as expected (the value is reset to '0'...
|
by: corykendall |
last post by:
Here is my code:
...
Setting hidden input to: <dsp:valueof param="tabname"/>
<input name="tabname" type="hidden" value='<dsp:valueof param="tabname"/>'/>
</dsp:form>
hidden input set to:<script language="JavaScript"> document.write(document.getElementById("tab_switchRefreshForm").elements.tabname.value);</script><BR/>
Now when I'm in IE, everything works fine and the output is as follows:
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |