Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Rebind Only RadGrid in NestedViewTemplate

$
0
0

I am experiencing a similar problem, and I feel that I must be missing something simple.

I have a radgrid which auto-refreshes with a Timer. 

I want my user to be able to click a hyperlink on a NestedViewTemplate in a radgrid, which will stop the timer and open a radwindow -- a separate page, not a content area -- where they will complete their data operations. On closing the radwindow (whether or not any data is updated), the radgrid should refresh and the timer should re-start.

so I am using 
ON PARENT PAGE
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script language="javascript" type="text/javascript">

        function openAttachmentsWindow(TicketID) {
            var timer = $find('<%= Timer1.ClientID %>');
            timer._stopTimer();
            var lbl = document.getElementById('<%= lblTimer.ClientID %>');
            lbl.innerHTML = 'waiting';

            var oWnd = radopen("TicketAttachments.aspx?id=" + TicketID, "radwinAttachments");
            return false;
        }

function refreshGrid(arg) {
            if (!arg) {
                document.getElementById('<%=lblTimer.ClientID%>').innerHTML = '';
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                $find("<%= lblTimer.ClientID%>")._startTimer();
                
            }
            else {
                document.getElementById('<%=lblTimer.ClientID%>').innerHTML = '';
                $find('<%= RadAjaxManager1.ClientID %>').ajaxRequest("RebindAndNavigate");
                $find('<%=Timer1.ClientID%>')._startTimer();
            }
        }
    </script>
</telerik:RadCodeBlock>

 

 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ddlGridFilter">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="lblProblem" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls>  
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>  
                    <telerik:AjaxUpdatedControl ControlID="lblTimer" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls>  
            </telerik:AjaxSetting>  
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls>  
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"  LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>  
            </telerik:AjaxSetting>  
            </AjaxSettings>
        </telerik:RadAjaxManager>

 

...radgrid...where I want the NestedViewTemplate to update!

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" 
        AutoGenerateColumns="False" AllowAutomaticUpdates="True"  OnItemDataBound="RadGrid1_ItemDataBound" 
        OnPreRender="RadGrid1_PreRender" EnableLinqExpressions="false" OnItemCreated="RadGrid1_ItemCreated"
        OnItemCommand="RadGrid1_ItemCommand" OnDataBound="RadGrid1_DataBound" GridLines="Horizontal" AllowSorting="true" AllowPaging="true" PageSize="50" AllowFilteringByColumn="true" 
        >
        <MasterTableView Name="CallMasterID" DataKeyNames="CallMasterID" TableLayout="Auto" GridLines="Horizontal" CommandItemDisplay="Top" EnableViewState="false">

            <%-- panel to display details and buttons for radwindows --%>
            <NestedViewTemplate>......</NVT> etc

on its code-behind:

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "Rebind")
        {
            //RadGrid1.MasterTableView.SortExpressions.Clear();
            //RadGrid1.MasterTableView.GroupByExpressions.Clear();
            RadGrid1.DataSource = null;
            RadGrid1.CurrentPageIndex = 0;// GetDataTable(query);
            RadGrid1.Rebind();
        }
        else if (e.Argument == "RebindAndNavigate")
        {
            //RadGrid1.MasterTableView.SortExpressions.Clear();
            //RadGrid1.MasterTableView.GroupByExpressions.Clear();
            //RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;
            //RadGrid1.Rebind();
            RadGrid1.DataSource = null;
            RadGrid1.CurrentPageIndex = 0;// GetDataTable(query);
            RadGrid1.Rebind();
        }
    }   

 

ON RADWINDOW PAGE (child) since I want the parent to update n o matter what, I put this in the Page_Unload event. is this causing a problem?

 

 protected void Page_Unload(object sender, EventArgs e)
    {
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
    }

 

Basically, I have done all I can to follow the Grid/Window Integration demo and while my "waiting" label and timer get re-started when the CloseAndRebind() runs, the radgrid and its NVT don't update before the next timer Tick. Can you help?

Thanks!

Amy


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>