Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > hidden inputs and viewstate

Reply
Thread Tools

hidden inputs and viewstate

 
 
dawidg
Guest
Posts: n/a
 
      06-11-2008
I have an asp.net page with viewstate disabled. I have a control on
the page that dynamically creates controls inside itself, no
viewstate. The controls aren't created in Init, but in Load.

With Viewstate disabled, a few hidden inputs appear in the beginning
of the page, all name h_*. Nowhere in my code do I create these. The
problem is that these hidden input create errors on postback if my
controls doesn't create the same number of controls. this is the
error:

An error has occurred because a control with id 'ctl14' could not be
located or a different control is assigned to the same ID after
postback. If the ID is not assigned, explicitly set the ID property of
controls that raise postback events to avoid this error.


Here's the inputs I'm talking about:
<body>
<form name="form1" method="post" action="Module.aspx?
tvid=32&amp;TableId=10&amp;ViewType=1" id="form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /
>

<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
value="" />
<input type="hidden" name="h_ctl14" id="h_ctl14" value="" />
<input type="hidden" name="h_ctl16" id="h_ctl16" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="...=" /
>

</div>



Why are these h_* inputs created?
 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      06-11-2008
Hello dawidg,

There is no such controls by default.
Try to create empy page to verify that.

Do u use any 3rd party libs?

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


d> I have an asp.net page with viewstate disabled. I have a control on
d> the page that dynamically creates controls inside itself, no
d> viewstate. The controls aren't created in Init, but in Load.
d>
d> With Viewstate disabled, a few hidden inputs appear in the beginning
d> of the page, all name h_*. Nowhere in my code do I create these. The
d> problem is that these hidden input create errors on postback if my
d> controls doesn't create the same number of controls. this is the
d> error:
d>
d> An error has occurred because a control with id 'ctl14' could not be
d> located or a different control is assigned to the same ID after
d> postback. If the ID is not assigned, explicitly set the ID property
d> of controls that raise postback events to avoid this error.
d>
d> Here's the inputs I'm talking about:
d> <body>
d> <form name="form1" method="post" action="Module.aspx?
d> tvid=32&amp;TableId=10&amp;ViewType=1" id="form1">
d> <div>
d> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""
d> /
d> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
d> value="" />
d> <input type="hidden" name="h_ctl14" id="h_ctl14" value="" />
d> <input type="hidden" name="h_ctl16" id="h_ctl16" value="" />
d> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="...="
d> /
d> </div>
d>
d> Why are these h_* inputs created?
d>


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      06-11-2008
you are using a 3rd party control that creates hidden fields based on its
name. as you have not assigned an id to the control, it assigned by the
server. on postback you are not creating the controls in the same order, so
the names are different. just explicitly name the controls.

-- bruce (sqlwork.com)


"dawidg" wrote:

> I have an asp.net page with viewstate disabled. I have a control on
> the page that dynamically creates controls inside itself, no
> viewstate. The controls aren't created in Init, but in Load.
>
> With Viewstate disabled, a few hidden inputs appear in the beginning
> of the page, all name h_*. Nowhere in my code do I create these. The
> problem is that these hidden input create errors on postback if my
> controls doesn't create the same number of controls. this is the
> error:
>
> An error has occurred because a control with id 'ctl14' could not be
> located or a different control is assigned to the same ID after
> postback. If the ID is not assigned, explicitly set the ID property of
> controls that raise postback events to avoid this error.
>
>
> Here's the inputs I'm talking about:
> <body>
> <form name="form1" method="post" action="Module.aspx?
> tvid=32&TableId=10&ViewType=1" id="form1">
> <div>
> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /
> >

> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
> value="" />
> <input type="hidden" name="h_ctl14" id="h_ctl14" value="" />
> <input type="hidden" name="h_ctl16" id="h_ctl16" value="" />
> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="...=" /
> >

> </div>
>
>
>
> Why are these h_* inputs created?
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Hidden field on post back and retrieve value from Hidden Field Rick ASP .Net 3 04-13-2010 05:38 PM
Win 7 folders hidden despite 'show hidden' checked Boppy NZ Computing 10 01-23-2010 02:56 AM
char encoding in hidden inputs Pif HTML 1 12-22-2009 03:53 PM
How would I discover the text in a block element hidden by overflow:hidden style being set? SolarCanine Javascript 2 09-20-2005 06:27 PM
CGI.pm and special characters in hidden inputs tsunami@zedxinc.com Perl Misc 15 12-30-2004 03:58 PM



Advertisments