Refreshing Grids Inside multipageview tabstrip

1 posts, 0 answers
  1. Henry Derstine
    Henry Derstine avatar
    112 posts
    Member since:
    Dec 2005

    Posted 13 Aug 2009 Link to this post

    I have a master grid that sits at the top of my page. Below it there is a tabstrip with three tabs. In each tab I have a multipageview which holds a user control that holds a grid. I used the TabStrip / Load on Demand RadPageView demo as a starting point. When the user selects a row from the parent grid the grid in the selected tab should be refreshed to show the appropriate data based upon a datakeyvalue. I am having a problem because the child grid in the usercontrol fires the needdatasource event before the selecteditem event fires on the mastergrid. Therefore the displayed information is based upon the previous datakeyvalue. I can not seem to figure out how to fire the tabclick event serverside which in turn would fire the needdatasource after I have set the appropriate keyvalue. Any help would be appreciated.

    'main aspx page

    <%

    @ Page Title="" Language="VB" MasterPageFile="~/secure/Institution.master" AutoEventWireup="false" CodeFile="Exams.aspx.vb" Inherits="secure_Exams" %>

     

    <%

    @ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

     

     

    <

     

    asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">

     

     

     

     

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

     

     

    </telerik:RadScriptManager>

     

     

    <telerik:RadGrid ID="radExams" runat="server" GridLines="None">

     

    <

     

    MasterTableView datakeynames="ExamID">

     

    <

     

    RowIndicatorColumn>

     

    <

     

    HeaderStyle Width="20px"></HeaderStyle>

     

    </

     

    RowIndicatorColumn>

     

    <

     

    ExpandCollapseColumn>

     

    <

     

    HeaderStyle Width="20px"></HeaderStyle>

     

    </

     

    ExpandCollapseColumn>

     

     

    <Columns>

     

     

    <telerik:GridButtonColumn CommandName="Select" Text="Select"

     

     

    UniqueName="column1">

     

     

    </telerik:GridButtonColumn>

     

     

    <telerik:GridEditCommandColumn>

     

     

    </telerik:GridEditCommandColumn>

     

     

    <telerik:GridButtonColumn CommandName="Delete" Text="Delete"

     

     

    UniqueName="column">

     

     

    </telerik:GridButtonColumn>

     

     

    </Columns>

     

    </

     

    MasterTableView>

     

     

    </telerik:RadGrid>

     

     

    <asp:Panel ID="pnlDetails" runat="server">

     

     

     

    <telerik:RadTabStrip ID="RadTabStrip1" SelectedIndex="0"

     

     

    runat="server" MultiPageID="RadMultiPage1" Skin="Office2007"

     

     

    Orientation="HorizontalBottom" ClickSelectedTab="True">

     

     

    </telerik:RadTabStrip>

     

     

    <telerik:RadMultiPage ID="RadMultiPage1" Runat="server" SelectedIndex="0"

     

     

    RenderSelectedPageOnly="True">

     

     

    </telerik:RadMultiPage>

     

     

    </asp:Panel>

     

     

    <telerik:RadAjaxManager runat="server">

     

     

    <AjaxSettings>

     

     

    <telerik:AjaxSetting AjaxControlID="radExams">

     

     

    <UpdatedControls>

     

     

    <telerik:AjaxUpdatedControl ControlID="radExams" />

     

     

    <telerik:AjaxUpdatedControl ControlID="pnlDetails" />

     

     

    </UpdatedControls>

     

     

    </telerik:AjaxSetting>

     

     

    <telerik:AjaxSetting AjaxControlID="RadTabStrip1">

     

     

    <UpdatedControls>

     

     

    <telerik:AjaxUpdatedControl ControlID="pnlDetails" />

     

     

    </UpdatedControls>

     

     

    </telerik:AjaxSetting>

     

     

    </AjaxSettings>

     

     

    </telerik:RadAjaxManager>

     

    </

     

    asp:Content>

     





    'Creation of Tabstrip-

    Protected

     

    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

     

     

     

    If Not Page.IsPostBack Then

     

     

    AddTab(

    "ExamRatings")

     

    AddPageView(RadTabStrip1.FindTabByText(

     

    "ExamRatings"))

     

    AddTab(

     

    "ExamEvents")

     

    AddTab(

     

    "ExamNotes")

     

     

     

    End If

     

     

     

    End Sub

     

     

     

    Private Sub AddTab(ByVal tabName As String)

     

     

     

    Dim tab As RadTab = New RadTab

     

    tab.Text = tabName

    RadTabStrip1.Tabs.Add(tab)

     

     

    End Sub

     

     

     

    Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated

     

     

     

    Dim userControlName As String = e.PageView.ID & ".ascx"

     

     

     

    Dim userControl As Control = Page.LoadControl(userControlName)

     

    userControl.ID = e.PageView.ID &

     

    "_userControl"

     

     

    e.PageView.Controls.Add(userControl)

     

    End Sub

     

     

     

    Private Sub AddPageView(ByVal tab As RadTab)

     

     

     

    If Not RadMultiPage1.FindPageViewByID(tab.Text) Is Nothing Then

     

     

     

    Exit Sub

     

     

     

    End If

     

     

     

    Dim pageView As RadPageView = New RadPageView

     

    pageView.ID = tab.Text

    RadMultiPage1.PageViews.Add(pageView)

    pageView.CssClass =

     

    "pageView"

     

     

    tab.PageViewID = pageView.ID

     

    End Sub

     

     

     

    Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick

     

    AddPageView(e.Tab)

    e.Tab.PageView.Selected =

     

    True

     

     

     

    End Sub

    'Master grid select event to identify the datakeyvalue

     

    Protected

     

    Sub radExams_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles radExams.ItemCommand

     

     

     

    Select Case e.CommandName
    Case RadGrid.SelectCommandName

     

     

    Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)

     

    Session(

     

    "ExamID") = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("ExamID").ToString

     

     

     

    End Select

     

     


    'Code behind for one of the usercontrols (they are basically the same)

    Protected

     

    ReadOnly Property ExamEventsData() As DataTable

     

     

     

    Get

     

     

     

    Dim aExamEventsData As DataTable

     

    aExamEventsData = aDFICISObj.GetExamEvents(Session(

     

    "ExamID"))

     

     

     

    Return aExamEventsData

     

     

     

    End Get

     

     

     

    End Property

     

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

     

     

     

    Me.radExamEvents.Rebind()

     

     

     

    End Sub

     

     

     

    Protected Sub radExamEvents_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles radExamEvents.NeedDataSource

     

     

     

    Me.radExamEvents.DataSource = ExamEventsData

     

     

     

    End Sub

     

     


     

     

Back to Top