_ctl5:_ctl0:p1456 in webform textbox

S

Steve Steve

Hello

I've got a bit of a problem here!

Right, I manage my shopping basket on my shop website by just storing
the ids and quantities of the products the customer has added in the
Session - the textbox name that I use in product view to add a quantity
is a "P" and the itemid to pass to the next page - because there are
variants of the same product I have to create these rows in code but
when they submit they append "_ctl5:_ctl0:" to the beginning in the URL.
This isn't really a problem in itself as long as this remains the same
so when I come to request I can check for:
Request.QueryString["_ctl5:_ctl0:p4321"] for example to get at the
quantity value. 'P' followed by the id of '4321' so in the url I might
have expected &p4321=100 if a customer selected 100 quantity.

Right that explained - here is my problem - for the second time now this
"_ctl5:_ctl0:" has changed - this time to "_ctl4:_ctl0:" spontaneously
and it isn't the first time it's happened! That means that from a fully
functional basket all of a sudden I get server errors because the id
passed from textbox has changed.

My Question then is can this appendation be altered or bypassed
altogether so that this problem goes away?

Thanks
Steve
 
S

Steve Steve

I've managed to fix this on my application but not to my satisfaction -
it seems the field that is causing my problem is an HtmlInputHidden
which we set server side - I create the hidden like this in html

<input type="hidden" id="recno" name="recno" runat="server">

i.e. I set no value but runat=server so I can set it in code.

When the control is then created on the page the prefix is already there
- I assume it must be something to do with running it at server?

My solution is to store the prefix in the session when a control using
it is created (from base.UniqueId) and then the Session variable is
available when I need it. The problem with this is that I'm building a
site where the Session needs to be kept to a minimum to preserve RAM as
one of the requirements and I'm loathed to add more variables to it than
needed.

If anybody knows how to remove this prefix altogether when the control
is created could you please post and then I can get rid of the extra
Session var?

I have read about someone subclassing the radiobutton they were
including and overriding the UniqueId of the control they were creating
but I'm not sure where to start with this - any insight would be
appreciated.

Thanks
Steve
 
A

Alessandro Zifiglio

hi steve, your controls are put in that namespace because they are child
controls. This is necessary to maintain unique ids through your page.

To remove the prefix you need to remove the control from within the
container(parent control) you placed it in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top