Groups | Blog | Home
all groups > asp.net webcontrols > october 2003 >

asp.net webcontrols : Webcontrol containing other controls issue (please, IMPORTANT!)



Ivan Demkovitch
10/7/2003 12:33:52 PM
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!



Ivan Demkovitch
10/7/2003 3:16:06 PM
SOLVED

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

Changing Page.FindControl to this.FindControl cured problem.


[quoted text, click to view]

AddThis Social Bookmark Button