Home All Groups Group Topic Archive Search About

Input fields are renamed with runat="server", how do I change it

Author
14 Jan 2006 7:48 PM
jamessmb
Hello,

I have a webform which needs to post to PayPal. One of the elements is a
hidden field which I am populating with a value from the URL. In order to do
this, I have to use runat="server'. But when I do, ASP.NET will rename the
field. The field needs to be named "custom" so PayPal will know what to do
with it.

How can I prevent this, or what can I do?
Thanks,
James

Author
16 Jan 2006 12:13 AM
Axel Dahmen
Can't reproduce this. Which version of .NET are you using?

Axel Dahmen

---------------
Show quoteHide quote
"jamessmb" <james***@discussions.microsoft.com> schrieb im Newsbeitrag
news:D1EE254F-4673-4338-BD7A-8D313E583908@microsoft.com...
> Hello,
>
> I have a webform which needs to post to PayPal. One of the elements is a
> hidden field which I am populating with a value from the URL. In order to
do
> this, I have to use runat="server'. But when I do, ASP.NET will rename the
> field. The field needs to be named "custom" so PayPal will know what to do
> with it.
>
> How can I prevent this, or what can I do?
> Thanks,
> James
Are all your drivers up to date? click for free checkup

Author
16 Jan 2006 12:32 AM
jamessmb
Hi,

I'm using version 2

create an input field like this:
<input type="hidden" id="custom" name="custom" value="" runat="server" />

What is rendered is this:

<input name="ctl00$ctl00$SiteContentPlaceHolder$CenterColumn$custom"
type="hidden" id="ctl00_ctl00_SiteContentPlaceHolder_CenterColumn_custom" />

I actually did find a workaround with Javascript, since the "custom"
variable is passed in the query string to this page:

var uName = document.location.search;
var uNameArr = uName.split("=");
document.getElementById('custom').value = uNameArr[1];

However, I still would like to know how to deal with this. It seems to me
there should be a way to keep the name.

Thanks,
James
Show quoteHide quote
"Axel Dahmen" wrote:

> Can't reproduce this. Which version of .NET are you using?
>
> Axel Dahmen
>
> ---------------
> "jamessmb" <james***@discussions.microsoft.com> schrieb im Newsbeitrag
> news:D1EE254F-4673-4338-BD7A-8D313E583908@microsoft.com...
> > Hello,
> >
> > I have a webform which needs to post to PayPal. One of the elements is a
> > hidden field which I am populating with a value from the URL. In order to
> do
> > this, I have to use runat="server'. But when I do, ASP.NET will rename the
> > field. The field needs to be named "custom" so PayPal will know what to do
> > with it.
> >
> > How can I prevent this, or what can I do?
> > Thanks,
> > James
>
>
>
Author
17 Jan 2006 8:15 PM
Keith Patrick
You could subclass HtmlInputHidden (or whatever that thing is called;
there's 2 similarly-named ones, and I can never remember which is which) and
override ClientID and UniqueID, but that behavior is otherwise by design, as
it needs to prepend the control tree before the name/ID so that two
identically-named fields (gets common with user controls) don't "collide"

Bookmark and Share