I've a question about dynamically loaded controls and events in these controls ( button click in my case :)
Here is what i got one RadPanelBar a Button and hidden input:
<telerik:RadPanelBar ID="languagesPanelBar" runat="server">
</telerik:RadPanelBar>
<asp:Button ID="Button1" runat="server" OnClientClick="funcation(){document.getElementById('someHiddenField').value='true';}" />
<input id="someHiddenField" type="hidden" runat="server" value="false" />
than on PageLoad event i check if someHiddenField value is true or not, if it's true the new item with dynamically loaded control is added to RadPanelBar :
void Page_Load(object sender, EventArgs e)
{
if(someHiddenField.Value == "true")
{
RadPanelItem newRootItem = new RadPanelItem();
RadPanelItem newChildIteam = new RadPanelItem();
Control ctrl = LoadControl("testControl.ascx");
ctrl.ID = "testCtrl";
newChildItem.Controls.Add(ctrl);
newRootItem.Items.Add(newChildItem);
languagesPanelBar.Items.Add(newRootItem);
}
}
testControl.ascx have a button in it, but for some reason the onClick event wont fire when control is created dynamically.
Would be glad to hear any suggestion how to solve this problem :)
Thank You in Advance !
Move controls creation code to Page_Init event.