We use RadTabStrip with 4 RadMultiPages but I doesn't get it work. the seon userControl gets loaded but isn't shown in the page.
We change the tabs with a button in the webpage (Button1_Click):
code behind:
Has someone the solution?
Chtistian
We change the tabs with a button in the webpage (Button1_Click):
| <telerik:RadTabStrip ID="RadTabStrip1" runat="server" AutoPostBack="true" OnTabClick="RadTabStrip1_TabClick" MultiPageID="RadMultiPage1"> |
| <Tabs> |
| <telerik:RadTab id="Tab01" Value="1" runat="server" Text="Import" Selected="true"/> |
| <telerik:RadTab id="Tab02" Value="2" runat="server" Text="Feldzuordnung" /> |
| <telerik:RadTab id="Tab03" Value="3" runat="server" Text="Filtereinstellungen" /> |
| <telerik:RadTab id="Tab04" Value="4" runat="server" Text="Stammdatenabgleich" /> |
| </Tabs> |
| </telerik:RadTabStrip> |
| <table cellspacing="0" cellpadding="0" width="850px" border="0"> |
| <tr> |
| <td class="TabsPanelTopBody"> |
| </td> |
| </tr> |
| <tr> |
| <td class="TabsPanelMainBody"> |
| <asp:Panel ID="Panel1" runat="server"> |
| <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0"> |
| <telerik:RadPageView ID="RadPageView1" runat="server" /> |
| <telerik:RadPageView ID="RadPageView2" runat="server" /> |
| <telerik:RadPageView ID="RadPageView3" runat="server" /> |
| <telerik:RadPageView ID="RadPageView4" runat="server" /> |
| </telerik:RadMultiPage> |
| </asp:Panel> |
| </td> |
| </tr> |
| </table> |
code behind:
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| If Me.CurrentControl <> String.Empty And CurrentControl <> "import.ascx" Then |
| 'LoadMyUserControl(CurrentControl, Me.RadPageView2) |
| LoadMyUserControl(CurrentControl, RadTabStrip1.SelectedTab.PageView) |
| End If |
| End Sub |
| Public Property CurrentControl() As String |
| Get |
| Dim obj As Object = Session("CurrentControl") |
| If obj Is Nothing Then Return String.Empty Else Return CStr(obj) |
| End Get |
| Set(ByVal value As String) |
| Session("CurrentControl") = value |
| End Set |
| End Property |
| Public Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated |
| If Not created Then |
| If CurrentControl = "" Or CurrentControl = "import.ascx" Then |
| Dim userControlName As String = "import.ascx" |
| LoadMyUserControl(userControlName, e.PageView) |
| created = True |
| Button1.Text = "Datei importieren" |
| End If |
| If CurrentControl = "MappingField.ascx" Then |
| Dim userControlName As String = "MappingField.ascx" |
| LoadMyUserControl(userControlName, Me.RadPageView2) |
| 'LoadMyUserControl(userControlName, e.PageView) |
| created = True |
| 'Button1.Text = "Datei importieren" |
| End If |
| End If |
| End Sub |
| Private Sub LoadMyUserControl(ByVal controlName As String, ByVal parent As Control) |
| parent.Controls.Clear() |
| Dim userControlID As String |
| userControlID = controlName |
| Dim MyControl As Object = LoadControl(controlName) |
| MyControl.ID = userControlID.Replace("/", "").Replace("~", "").Replace(".", "_") |
| If controlName = "import.ascx" Then |
| 'Dateityp 1=Stammdaten setzen |
| Dim objType As Type = MyControl.GetType |
| Dim p As PropertyInfo = objType.GetProperty("TYPE") |
| p.SetValue(MyControl, 1, Nothing) |
| End If |
| parent.Controls.Add(MyControl) |
| Me.CurrentControl = controlName |
| End Sub |
| Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click |
| For index As Integer = 0 To Me.RadPageView1.Controls.Count - 1 |
| Dim cc As Control = Me.RadPageView1.Controls(index) |
| Next |
| For index As Integer = 0 To Me.RadPageView2.Controls.Count - 1 |
| Dim cc As Control = Me.RadPageView2.Controls(index) |
| Next |
| Dim actualCurrentControl = CurrentControl |
| If actualCurrentControl = "import.ascx" Then |
| Dim result As Boolean = CType(Me.RadPageView1.Controls(0), ISaveFunction).save(sender, e) |
| If result Then |
| Button1.Text = "Feldzuordnung speichern" |
| RadTabStrip1.SelectedIndex = RadTabStrip1.SelectedIndex + 1 |
| LoadMyUserControl("MappingField.ascx", RadTabStrip1.SelectedTab.PageView) |
| 'LoadMyUserControl("MappingField.ascx", Me.RadPageView2) |
| Else |
| 'todo: Fehler ausgeben |
| End If |
| End If |
| If actualCurrentControl = "MappingField.ascx" Then |
| Dim c As Control = Me.RadPageView2.Controls(0) |
| Dim result As Boolean = CType(Me.RadPageView2.Controls(0), ISaveFunction).save(sender, e) |
| If result Then |
| Button1.Text = "Filter setzen" |
| RadTabStrip1.SelectedIndex = RadTabStrip1.SelectedIndex + 1 |
| LoadMyUserControl("Filter.ascx", RadTabStrip1.SelectedTab.PageView) |
| End If |
| End If |
| End Sub |
Has someone the solution?
Chtistian