Webcontrol containing other controls issue (please, IMPORTANT!)

  • Thread starter Thread starter Ivan Demkovitch
  • Start date Start date
I

Ivan Demkovitch

Hi!

I posted question while ago with no reply..

Here is wat I do:

I have website with 1 page (pgracing.com)
Each block/module is a control - .ascx.

In one of them I dynamically create comboboxes, textboxes, etc. Then I add
submit button and hook it up to event handler.

When button pressed I need to read values from this dynamically added
controls.

Page.Find control does not work because ID is not ID I assigned. It gets
prepended with somethig like "Ctl0_"

I understand that ASP.NET does this so I can distinguish between
usercontrols on a page, however it doesn't help me.

I can probably loop thru all controls and compare ID endings, but this
doesn't look correct to me.

How would I get a value? Please ask any questions if I'm not clear.


Thanks!
 
SOLVED

Since I had code in ASCX ID was prepended with additional ID for ASCX
itself.

Changing Page.FindControl to this.FindControl cured problem.
 
Back
Top