This is a migrated thread and some comments may be shown as answers.

RadWindow AJaxManager and Radgrid

1 Answer 147 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 26 Feb 2009, 11:39 PM
hello and good day.
Problem: Radconfirm windows stops working after AjaxManager rebinds the mastertableview
I'm having a strange issue in regards to using the GridButtonColumn confirmtext and radwindow when trying to use the ajaxManager. I have deduced that is has to do with the method in wich I am loading the control into my base aspx page, but am at a loss as to how to work around it or deal with it. ie..if i just drop the control into a default.aspx page, it works as expected and the confirm window continues to popup on each click.  however if I am trying to work from within loaded viewstate, it seems to be destroyed.

Ctrls Code: (trimmed for brevity )
<telerik:RadWindowManager ReloadOnShow="true" ID="RadWindowManager1" runat="server">  
</telerik:RadWindowManager> 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="False">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                <telerik:AjaxUpdatedControl ControlID="TermCancel_App" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
 
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="DSTerm" GridLines="None">  
    <MasterTableView AutoGenerateColumns="False"   
     FilterExpression="[ApprovedBy] Is Null AND [ApprovedOn] IS Null AND RemoveFromView =0" 
    DataKeyNames="TermID,Emp_id,Lname" DataSourceID="DSTerminations">  
        <Columns> 
            <telerik:GridButtonColumn ConfirmDialogType="radWindow" ConfirmText="Continue with termination?" 
         CommandName="Complete" Text="Terminate" /> 
        <telerik:GridButtonColumn ConfirmText="Are you sure you want to cancel?" Text="Cancel"    
        CommandName="Cancel" ConfirmDialogType="RadWindow" UniqueName="column" /> 
        </Columns> 
        </MasterTableView> </RadGrid>
          


Base Page Source
<asp:panel id="Panel1" runat="server"></panel>

Base Page Code
    Private Property LatestLoadedControlName() As String  
        Get  
            Return CStr(ViewState("LatestLoadedControlName"))  
        End Get  
        Set(ByVal value As String)  
            ViewState("LatestLoadedControlName") = value  
        End Set  
    End Property  
 
    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load  
        If Not (LatestLoadedControlName Is Nothing) Then  
            LoadUserControl(LatestLoadedControlName)  
        Else  
            LoadUserControl(ctrls(Request.QueryString("Page")))  
        End If  
    End Sub  
 
 
 
 
    Public Sub LoadUserControl(ByVal controlName As String)  
        If Not (LatestLoadedControlName Is Nothing) Then  
            Dim previousControl As Control = Panel1.FindControl(LatestLoadedControlName.Split("."c)(0))  
            If Not (previousControl Is Nothing) Then  
                Me.Panel1.Controls.Remove(previousControl)  
            End If  
        End If  
        Dim userControlID As String = controlName.Split("."c)(0)  
        Dim targetControl As Control = Panel1.FindControl(userControlID)  
        If targetControl Is Nothing Then  
            Dim userControl As UserControl = CType(Me.LoadControl(controlName), UserControl)  
            'slashes and tildes are forbidden  
            userControl.ID = userControlID.Replace("/", "").Replace("~", "")  
            Me.Panel1.Controls.Add(userControl)  
            LatestLoadedControlName = controlName 
        End If  
    End Sub  
 
 
    Function ctrls(ByVal ItemName As String) As String  
        Dim x As String = "" 
        Select Case ItemName  
            Case "Terminations"  
                x = "TerminationRequests.ascx" 
            Case Else  
                x = "DefaultCtrl.ascx" 
        End Select  
        Return x  
    End Function 


1 Answer, 1 is accepted

Sort by
0
mac
Top achievements
Rank 1
answered on 26 Feb 2009, 11:44 PM
For those of you that may run into a similar situation on handface thursday, moving the loadcontrol method into the page_init event may solve the problem. It solved mine after a couple hours.
Tags
Ajax
Asked by
mac
Top achievements
Rank 1
Answers by
mac
Top achievements
Rank 1
Share this question
or