Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > error reposting data

Reply
Thread Tools

error reposting data

 
 
Leon
Guest
Posts: n/a
 
      02-11-2010
Hi everybody.

I am adding image buttons to my web form programmatically and adding
onclientclick for each button to call java function to save some info. When
form is reposted I get an error message:

An error has occurred because a control with id
'ctl00$ContentPlaceHolder1$ctl01' 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.

Probably I get this message, because on repost I do not recreate those image
buttons and I do not need to recreate them, because I need to show just a big
picture of the product.

How can I avoid this problem?
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-12-2010
On Feb 11, 8:31*pm, Leon <(E-Mail Removed)> wrote:
> Hi everybody.
>
> I am adding image buttons to my web form programmatically and adding
> onclientclick for each button to call java function to save some info. When
> form is reposted I get an error message:
>
> An error has occurred because a control with id
> 'ctl00$ContentPlaceHolder1$ctl01' 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.
>
> Probably I get this message, because on repost I do not recreate those image
> buttons and I do not need to recreate them, because I need to show just a big
> picture of the product.
>
> How can I avoid this problem?


Did you add unique id to each control when you create it from the code?
 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      02-12-2010
Leon

If it's a javascript call that's being made from the button and there is no
need to post back to the server then you could correct this error by
stopping the post-back altogether by adding: "return false;" to your
javascript called from the button.

However if someone has javascript turned off then the postback will still
occur and if you don't recreated the dynamic controls in .net you will
always get the error.

--


Sincerely,

S. Justin Gengo, MCP

Free code library at:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche

"Leon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi everybody.
>
> I am adding image buttons to my web form programmatically and adding
> onclientclick for each button to call java function to save some info.
> When
> form is reposted I get an error message:
>
> An error has occurred because a control with id
> 'ctl00$ContentPlaceHolder1$ctl01' 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.
>
> Probably I get this message, because on repost I do not recreate those
> image
> buttons and I do not need to recreate them, because I need to show just a
> big
> picture of the product.
>
> How can I avoid this problem?


 
Reply With Quote
 
Leon
Guest
Posts: n/a
 
      02-12-2010

No. I did not. Would it help if I did?

"Alexey Smirnov" wrote:

> On Feb 11, 8:31 pm, Leon <(E-Mail Removed)> wrote:
> > Hi everybody.
> >
> > I am adding image buttons to my web form programmatically and adding
> > onclientclick for each button to call java function to save some info. When
> > form is reposted I get an error message:
> >
> > An error has occurred because a control with id
> > 'ctl00$ContentPlaceHolder1$ctl01' 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.
> >
> > Probably I get this message, because on repost I do not recreate those image
> > buttons and I do not need to recreate them, because I need to show just a big
> > picture of the product.
> >
> > How can I avoid this problem?

>
> Did you add unique id to each control when you create it from the code?
> .
>

 
Reply With Quote
 
Leon
Guest
Posts: n/a
 
      02-12-2010
I do need to postback. I need to show a large picture of selected product. Is
there any other way to do the same thing?

"S. Justin Gengo" wrote:

> Leon
>
> If it's a javascript call that's being made from the button and there is no
> need to post back to the server then you could correct this error by
> stopping the post-back altogether by adding: "return false;" to your
> javascript called from the button.
>
> However if someone has javascript turned off then the postback will still
> occur and if you don't recreated the dynamic controls in .net you will
> always get the error.
>
> --
>
>
> Sincerely,
>
> S. Justin Gengo, MCP
>
> Free code library at:
> http://www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
>
> "Leon" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi everybody.
> >
> > I am adding image buttons to my web form programmatically and adding
> > onclientclick for each button to call java function to save some info.
> > When
> > form is reposted I get an error message:
> >
> > An error has occurred because a control with id
> > 'ctl00$ContentPlaceHolder1$ctl01' 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.
> >
> > Probably I get this message, because on repost I do not recreate those
> > image
> > buttons and I do not need to recreate them, because I need to show just a
> > big
> > picture of the product.
> >
> > How can I avoid this problem?

>
> .
>

 
Reply With Quote
 
Leon
Guest
Posts: n/a
 
      02-12-2010
Alexey.

I tried your suggestion and it worked.
Thanks a lot.



"Alexey Smirnov" wrote:

> On Feb 11, 8:31 pm, Leon <(E-Mail Removed)> wrote:
> > Hi everybody.
> >
> > I am adding image buttons to my web form programmatically and adding
> > onclientclick for each button to call java function to save some info. When
> > form is reposted I get an error message:
> >
> > An error has occurred because a control with id
> > 'ctl00$ContentPlaceHolder1$ctl01' 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.
> >
> > Probably I get this message, because on repost I do not recreate those image
> > buttons and I do not need to recreate them, because I need to show just a big
> > picture of the product.
> >
> > How can I avoid this problem?

>
> Did you add unique id to each control when you create it from the code?
> .
>

 
Reply With Quote
 
S. Justin Gengo
Guest
Posts: n/a
 
      02-14-2010
Leon,

If you need to re-post dot net wants to automatically check the values of
the controls posted back. So you'll need to re-create the dynamic controls
each time. That's what dot net would do if the controls were added to the
page normally so you aren't creating more work than normal. You're just
re-creating them on your own rather than using the framework to do so.


--


Sincerely,

S. Justin Gengo, MCP

Free code library at:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche

"Leon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I do need to postback. I need to show a large picture of selected product.
> Is
> there any other way to do the same thing?
>
> "S. Justin Gengo" wrote:
>
>> Leon
>>
>> If it's a javascript call that's being made from the button and there is
>> no
>> need to post back to the server then you could correct this error by
>> stopping the post-back altogether by adding: "return false;" to your
>> javascript called from the button.
>>
>> However if someone has javascript turned off then the postback will still
>> occur and if you don't recreated the dynamic controls in .net you will
>> always get the error.
>>
>> --
>>
>>
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>>
>> Free code library at:
>> http://www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>>
>> "Leon" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hi everybody.
>> >
>> > I am adding image buttons to my web form programmatically and adding
>> > onclientclick for each button to call java function to save some info.
>> > When
>> > form is reposted I get an error message:
>> >
>> > An error has occurred because a control with id
>> > 'ctl00$ContentPlaceHolder1$ctl01' 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.
>> >
>> > Probably I get this message, because on repost I do not recreate those
>> > image
>> > buttons and I do not need to recreate them, because I need to show just
>> > a
>> > big
>> > picture of the product.
>> >
>> > How can I avoid this problem?

>>
>> .
>>

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-14-2010
On Feb 12, 7:33*pm, Leon <(E-Mail Removed)> wrote:
> No. I did not. Would it help if I did?
>
>
>
> "Alexey Smirnov" wrote:
> > On Feb 11, 8:31 pm, Leon <(E-Mail Removed)> wrote:
> > > Hi everybody.

>
> > > I am adding image buttons to my web form programmatically and adding
> > > onclientclick for each button to call java function to save some info.. When
> > > form is reposted I get an error message:

>
> > > An error has occurred because a control with id
> > > 'ctl00$ContentPlaceHolder1$ctl01' 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.

>
> > > Probably I get this message, because on repost I do not recreate those image
> > > buttons and I do not need to recreate them, because I need to show just a big
> > > picture of the product.

>
> > > How can I avoid this problem?

>
> > Did you add unique id to each control when you create it from the code?
> > .- Hide quoted text -

>
> - Show quoted text -


Yes, it helped as you can see. It was also mentioned in the error
message you got: "If the ID is not assigned, explicitly set the ID
property of controls that raise postback events to avoid this error".
Glad, that it helps,

Cheers!

 
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
reposting form data Administrator ASP .Net 1 01-04-2009 10:53 AM
Reposting: Problems accessing Windows Controls in Web page Netsharp Ninja ASP .Net 0 04-05-2004 05:09 PM
sorry for reposting sean MCSE 5 03-03-2004 08:26 PM
Reposting--which one is better? nomi MCSD 1 07-17-2003 12:27 PM
RePosting window.opener windows to server. Ersin Gençtürk ASP .Net 0 07-03-2003 05:58 AM



Advertisments