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

[Solved] help with ajax in a simple listview

1 Answer 107 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 23 Jun 2009, 02:22 PM
hi telerik people!

I have the following code although im getting stuck in making the listview refresh using ajax from an event within a telerik popup window.

please provide some guidance, many many thanks,

the markup is below:


// javascript

            function myfunction() {

                var oManager = GetRadWindowManager();
                var oMailWnd = oManager.getWindowByName("mywindow");
                oMailWnd.SetUrl(filename);
                oMailWnd.show();
                oMailWnd.setActive(true);
                oMailWnd.center();

                return false;
            }


<asp:PlaceHolder ID="PlaceHolderExistingTracks" runat="server" Visible="true">
                
                
            <script language="javascript" type="text/javascript">
                    
                function Close() {
                    var masterTable = $find("<%= ListView1.ClientID %>").get_masterTableView();
                    masterTable.rebind();
                }
                  
            </script>
               
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>

    <telerik:RadWindowManager EnableEmbeddedSkins="true" ID="RadWindowManager1" VisibleStatusbar="false" runat="server" Skin="Default">
        <Windows>
          <telerik:RadWindow ID="mywindow" Modal="true" Title="xxx" VisibleStatusbar="false" Width="90px" Height="90px" runat="server">
            </telerik:RadWindow>


    <asp:ListView ID="ListView1" runat="server">
       <LayoutTemplate>
          <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
       </LayoutTemplate>

       <ItemTemplate>
          <div style="float: left; width: 200px;">
            <a href=""><%# Eval("test") %></a>
          </div>
          <div style="float: left; width: 200px;">
            <%# Eval("test2") %>
          </div>
          <div style="float: left; width: 200px;">
            <a href="javascript:void(0);" onclick="myfunction()" />open window</a>
          </div>
          <div style="clear:both"></div>
       </ItemTemplate>
    </asp:ListView>

</asp:PlaceHolder>


in my popup aspx file
===================


// javascript

 <script type="text/javascript">
        function CloseAndRebind(args)
        {
            GetRadWindow().Close();
            GetRadWindow().BrowserWindow.refreshGrid(args);
        }
     
        function GetRadWindow()
        {
         var oWindow = null;
         if (window.radWindow) oWindow = window.radWindow;
         else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
       
         return oWindow;
        }        
    </script>


markup for popup
==============

<asp:Button ID="ButtonConfirm" runat="server" Text="Confirm" resourcekey="ButtonConfirm" OnClick="ButtonConfirm_Click" />



code behind for popup
==============

not sure what I need here if anything
       

==============

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 26 Jun 2009, 11:31 AM
Hello James ,

You can utilize the approach presented on this RadControls integration demo:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid

and replace the grid instance with asp ListView to achieve similar result. The idea is to ajaxify the ListView via RadAjaxManager and use the ajaxRequest(args) client method of the manager to refresh its state. Review the explanation/code snippets from the demo for more details.

Greetings,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
James
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or