This is a migrated thread and some comments may be shown as answers.
What is the best method to load a Window with detail view content from a Grid?
6 Answers 249 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brad Sumner
Top achievements
Rank 1
Brad Sumner asked on 27 Jul 2010, 05:46 PM
I'm trying to use the Window control with a Grid control to create a Master/Detail view but I'm not sure what the best method is for updating the content of the Window control using ajax.   The LoadContentFrom method works fine when loading once but I'm not sure what the best method is to load from client script as you switch between records on the Grid.  It looks like there is a client side ajaxRequest method for the Window control but I'm not sure how or if it should be used.  Is it best to just use the jquery load method once you have a handle on the content div within the Window (http://www.telerik.com/help/aspnet-mvc/using-with-partial-views-loaded-via-ajax.html#jqueryajax)?
 
Thanks,
Brad

6 Answers, 1 is accepted

Sort by
0
Joshua
Top achievements
Rank 1
answered on 24 Aug 2010, 04:43 AM
I think I also have this issue now, I want to have users click on a row in a Grid and my telerik modal window will update itself based on the new ID paramter based on the row they selected.
I do not see the ability to update a paramter, do I have to use an IFrame as a work around and if so how would that work?  What are possibly solutions to this please?
0
nachid
Top achievements
Rank 1
answered on 24 Aug 2010, 10:47 AM
That's one of my requests to the development team to have an option to refresh dynamically the content of a Window

And I see here that I am not the only one with this need
For the moment, I just created a javascript function that I am calling when needed

 

function open(newTitle, newContent, newContentUrl)
{
  $("#ModalWindow .t-window-title").html(newTitle);
  
  var window = $("#ModalWindow").data("tWindow");
  
  if (newContent !== null)
  {
     $("#ModalWindow .t-window-content").html(newContent);
  }
  else
  {
     window.ajaxRequest(newContentUrl);
  }
   window.open();
}

 

 

0
Adam Salvo
Top achievements
Rank 1
answered on 08 Sep 2010, 04:30 PM
Thanks for the script, works great.
0
Wai Kei
Top achievements
Rank 1
answered on 16 Nov 2010, 09:54 PM
I modified the script a little bit to be:

function

 

 

openWindow(title, contentUrl)

 

{

      $(

 

"#ModalWindow .t-window-title").html(title);

 

 

 

 

      var window = $("#ModalWindow").data("tWindow");

 

 

 

 

      if (window != null)

 

      {

         window.ajaxRequest(contentUrl);

         window.open();

      }

}


It works great for the first time it opens the modal window. However, after I close the window then I try to open the window for the second time it does not work. I stepped through the javascript and $("#ModalWindow").data("tWindow") does not exist anymore thus it won't open.

This is the window:

Html.Telerik().Window()

.Name(

 

"ModalWindow")

 

.Title(

 

Utilities.GetResourceString("Terms"))

 

.Draggable(

 

true)

 

.Resizable(resizing => resizing

.Enabled(

 

true)

 

.MinHeight(250)

.MinWidth(250)

.MaxHeight(800)

.MaxWidth(1000)

)

.Modal(

 

true)

 

.Buttons(b => b.Maximize().Close())

.Width(400)

.Height(500)

.Visible(

 

false)

 

.Render();


What went wrong? When I close the window does it destroy the tWindow as well? if so, how do I create it back?

Thanks.
0
a c
Top achievements
Rank 1
answered on 01 Dec 2010, 07:44 AM
url must be a partial view (*.ascx).
0
Kevin Schneider
Top achievements
Rank 1
answered on 24 Jan 2011, 10:24 PM
** Edit - Whoops, wrong post**
Tags
Window
Asked by
Brad Sumner
Top achievements
Rank 1
Answers by
Joshua
Top achievements
Rank 1
nachid
Top achievements
Rank 1
Adam Salvo
Top achievements
Rank 1
Wai Kei
Top achievements
Rank 1
a c
Top achievements
Rank 1
Kevin Schneider
Top achievements
Rank 1
Share this question
or