Event doesn't launch in ASCX control

  • Thread starter Thread starter Diego F.
  • Start date Start date
D

Diego F.

Hi all. I'm using VS2005 Beta 2 and I encountered a problem with an event.

I had a User Control with a DataGrid with a CheckBox column like that:

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox AutoPostBack="false" ID="chkSel"
runat="server" EnableViewState=true
OnCheckedChanged="HtmlCheckBox_ServerChange" />
</ItemTemplate>
</asp:TemplateColumn>

It was working properly, but I had to include that DataGrid in other user
control, that I registered in the previous user control. Now, the event
doesn't run.

Is there any problem nesting user controls?
 
Well first thing that caught my eye was this - AutoPostBack="false"

but also - your user control, if you're adding it to your page
dynamically make sure you do it in the OnInit not in the Page_Load
 
Well first thing that caught my eye was this - AutoPostBack="false"

but also - your user control, if you're adding it to your page
dynamically make sure you do it in the OnInit not in the Page_Load

Thank you for posting.

The AutoPostBack=false is to avoid continuously loads in the page that can
disturb the user, so I wait until the user changes the page or clicks a
button.

The question here is that before using another control inside the main
control, it worked perfectly. It seems to be any limitation with that.
 
So you are sticking this control inside of a user control and then
dragging and dropping it onto your aspx page?

or are you adding it to your page dynamically use Page.LoadControl? If
so you need to do that before page_load so your events will work
correctly
 
Back
Top