Gridview not refreshing even when ajaxrequest is executed

2 posts, 0 answers
  1. Vijetha
    Vijetha avatar
    2 posts
    Member since:
    Oct 2011

    Posted 05 Oct 2011 Link to this post

    Hi,

    I have a asp gridview on the parent page and there is a button outside of the grid. On button click, radwindow popup appears. When the user closes the popup, it invokes the RadajaxManager's ajaxrequest on the parent page. The code steps into the _ajaxrequest and does gridview.databind. I can see that the number of rows are correct in the grid but when the process is complete, the grid does not refresh. I tried by replacing the asp gridview with Radgrid but still had no success.
    I am pasting my code here. Please let me know if I need to give more information.

    Any help is greatly appreciated..

    btnDelegate lauches the radwindow.
    function 
      
    openRadWindow(args) { 
    var EmpID = $find("<%=cboEmployee.ClientID %>")._value; 
    window.radopen("AdminDelegationPopup.aspx?EmpID=" + EmpID + "&Type=" + args, "RadWindow1"); }
      
       
      
       
      
    function refreshGrid(arg) {  
    if (arg == 'Delegation') { 
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Delegation"); // Invoking ajaxRequest }
      
       
      
    }

     

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
      
     <AjaxSettings> 
      
      <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
      
      <UpdatedControls> 
      
      <telerik:AjaxUpdatedControl ControlID="grdDelegatedRights" /> 
      
      <telerik:AjaxUpdatedControl ControlID="btnDelegate" /> 
      
      </UpdatedControls> 
      
     </telerik:AjaxSetting> 
      
    <telerik:AjaxSetting AjaxControlID="grdDelegatedRights"
      
     <UpdatedControls> 
      
     <telerik:AjaxUpdatedControl ControlID="grdDelegatedRights" /> 
      
     </UpdatedControls> 
      
     </telerik:AjaxSetting> 
      
     <telerik:AjaxSetting AjaxControlID="btnDelegate"
      
     <UpdatedControls> 
      
     <telerik:AjaxUpdatedControl ControlID="grdDelegatedRights" /> 
      
     <telerik:AjaxUpdatedControl ControlID="btnDelegate" /> 
      
     </UpdatedControls> 
      
     </telerik:AjaxSetting> 
      
     </AjaxSettings> 
      
     </telerik:RadAjaxManager> 
      
     <asp:GridView ID="grdDelegatedRights" runat="server" AutoGenerateColumns="False" CellPadding="4" Font-Names="Tahoma,Verdana" Font-Size="10px" ForeColor="#333333" Width="825px" AllowPaging="True" DataKeyNames="EmpDelegationId">  
    <Columns> 
      
     <asp:BoundField DataField = "EmpName" HeaderText = "Employee Name" /> 
      
    <asp:BoundField DataField="EmpId" HeaderText="Employee Id" /> 
      
     <asp:BoundField DataField="FullName" HeaderText="Delegated Employee" /> 
      
     <asp:BoundField DataField="SecurityRole" HeaderText="Role" /> 
      
     <asp:BoundField DataField="DateDelegated" HeaderText="Date Delegated" /> 
      
     <asp:TemplateField ShowHeader="False"
      
     <ItemTemplate> 
      
     <asp:ImageButton ID="imgRemoveDelegation" runat="server" CausesValidation="False" 
      
     CommandName="Delete" ImageUrl="~/Images/document_delete_small.gif" OnClientClick="return confirm('Are you sure you want to remove the delegation?');"  ToolTip="Remove the delegated rights" /> 
      
    </ItemTemplate> 
      
     <ItemStyle HorizontalAlign="Center" /> 
      
     </asp:TemplateField> 
      
     </Columns> 
      
     <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
      
     <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> 
      
     <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> 
      
     <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> 
      
     <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
      
     <EditRowStyle BackColor="#999999" /> 
      
     <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> 
      
     <PagerSettings Mode="NumericFirstLast" /> 
      
     </asp:GridView> 

     
    AjaxRequest..I am able to step into the following code succesfully.

    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) 
      
    If e.Argument = "Delegation" Then 
      
     Dim oDelegation As New Delegation 
      
     Dim dsDelegatedRights As DataSetdsDelegatedRights = oDelegation.GetDelegatedRights(cboEmployee.SelectedValue)grdDelegatedRights.DataSource = dsDelegatedRights
      
    grdDelegatedRights.DataBind()
    End If 
    End Sub

    this is on the radwindow.

     

    function
      
     CloseAndRebindGrid(args) { 
      
     GetRadWindow().Close();
      
    GetRadWindow().BrowserWindow.refreshGrid(args);
      
    }
  2. Vijetha
    Vijetha avatar
    2 posts
    Member since:
    Oct 2011

    Posted 06 Oct 2011 Link to this post

    I was able to figure out the issue. I placed the Scriptmanager above the RadAjaxManager in the aspx page and it is working fine now.
Back to Top