By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

Only first user control event fires.

P: n/a
Fairly new to so I'm sure what I'm doing wrong is silly...

I have created a user control which contains its own buttons,
textboxes, etc... and handles its own events. If I add just one of
these to a page either dynamically or otherwise it works great.

The problem is if I try to dynamically create more than 1 of these
user controls on a page only the first user control's events will
fire. The other user controls appear on the page, but their buttons
don't do anything when clicked.

Here is my code where I dynamically create my user controls:

while (sqlData.Read())
aControl = (DirMainListingControl)this.LoadControl("DirMainLi stingControl.ascx");
aControl.ID = sqlData["listing_id"].ToString();
aControl.SelectSite = sqlData["select_site"].ToString();
aControl.Category = sqlData["category"].ToString();
aControl.Title = sqlData["title"].ToString();
aControl.Description = sqlData["description"].ToString();
aControl.ListingId = System.Convert.ToInt32(sqlData["listing_id"]);
aControl.Active = sqlData["active"].ToString();
aControl.DateAdded = (DateTime)sqlData["date_added"];


So for example the first user control created when going through this
loop works great, but number 2 through ... appears, but its events
wont fire.

Anyone know what I am doing wrong?

Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.