I used an example found elsewhere on the Telerik forums to dynamically load user controls into a panel with a tabstrip control managing which control is loaded.
The original source gave two simple examples:
Default.aspx
TimerControl.ascx
and finally
SimpleControl.ascx
In the codebehind, the loaded control is determined from the viewstate, and I have successfully incorporated my controls in place of the two examples provided above. However, the entire page is being updated on postback.
In default.aspx I have set the ajax manager to update the tabstrip and panel and in my controls, I have set the ajax proxy to update only the controls that need to be updated, but it does not work correctly, still updating the entire page on each postback.
On another note, when I set OnTabClick to my click handler, I get a compile error indicating that the function is not part of the class. Removing it does not create a problem with the event firing, but I mention it because it may be the reason the entire page is updated.
The original source gave two simple examples:
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="RadTabStrip.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>Dynamically loaded user controls on tab click and a postback from a user control</
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
id
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
div
>
<
rad:RadTabStrip
ID
=
"RadTabStrip1"
runat
=
"server"
OnTabClick
=
"RadTabStrip1_TabClick"
AutoPostBack
=
"True"
>
<
Tabs
>
<
rad:Tab
runat
=
"server"
Text
=
"Simple control"
Value
=
"0"
>
</
rad:Tab
>
<
rad:Tab
runat
=
"server"
Text
=
"Timer Control"
Value
=
"1"
>
</
rad:Tab
>
</
Tabs
>
</
rad:RadTabStrip
>
<
telerik:radajaxmanager
id
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadTabStrip1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadTabStrip1"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Panel1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:radajaxmanager
>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
Height
=
"438px"
Width
=
"1192px"
>
</
asp:Panel
>
</
div
>
</
form
>
</
body
>
</
html
>
TimerControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TimerControl.ascx.cs" Inherits="TimerControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Timer
ID
=
"Timer1"
runat
=
"server"
Interval
=
"2000"
OnTick
=
"Timer1_Tick"
>
</
asp:Timer
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text="Timer is ticking <br/>Ticks: "></
asp:Label
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
Text
=
"0"
></
asp:Label
>
<
telerik:RadAjaxManagerProxy
ID
=
"RadAjaxManagerProxy1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"Timer1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Label2"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</telerik:RadAjaxManagerProxy
and finally
SimpleControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SimpleControl.ascx.cs" Inherits="SimpleControl" %>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Just a user control. Take a look at the other one."
></
asp:Label
>
In the codebehind, the loaded control is determined from the viewstate, and I have successfully incorporated my controls in place of the two examples provided above. However, the entire page is being updated on postback.
In default.aspx I have set the ajax manager to update the tabstrip and panel and in my controls, I have set the ajax proxy to update only the controls that need to be updated, but it does not work correctly, still updating the entire page on each postback.
On another note, when I set OnTabClick to my click handler, I get a compile error indicating that the function is not part of the class. Removing it does not create a problem with the event firing, but I mention it because it may be the reason the entire page is updated.