Hi,
I'm currently trying to open a radWindow on a parent page from a click on a button on a toolBar inside a grid (I get the idea from this demo), but it doesn't work well. The only thing I can do is to open the new window behind the current window and the modal/title attribute don't work at all (but the size it correct). If I try to open the window from a standard button, it works just fine. Is it anyone who know why this doesn't work ?
Thank you
David
Here is my code :
Default.aspx :
test.aspx:
test.aspx.cs:
EDIT :
Sorry, I notice that the title just work fine in this example. In fact, I realize that if I set a title in the <title></title> in the head of a aspx page, this title come over the title of the window setting.
I'm currently trying to open a radWindow on a parent page from a click on a button on a toolBar inside a grid (I get the idea from this demo), but it doesn't work well. The only thing I can do is to open the new window behind the current window and the modal/title attribute don't work at all (but the size it correct). If I try to open the window from a standard button, it works just fine. Is it anyone who know why this doesn't work ?
Thank you
David
Here is my code :
Default.aspx :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
function yo(sender, e) {
radopen("test.aspx", null);
}
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
EnableShadow
=
"true"
RestrictionZoneID
=
"RestrictionZone"
ShowContentDuringLoad
=
"False"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"win1"
runat
=
"server"
VisibleStatusbar
=
"false"
Behaviors
=
"Close,Move"
Width
=
"750px"
Height
=
"400px"
Modal
=
"true"
Title
=
"I'm not working"
/>
</
Windows
>
</
telerik:RadWindowManager
>
<
div
>
<
telerik:RadButton
ID
=
"yo"
runat
=
"server"
Text
=
"yo"
AutoPostBack
=
"false"
OnClientClicked
=
"yo"
>
</
telerik:RadButton
>
</
div
>
</
form
>
</
body
>
</
html
>
test.aspx:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
script
type
=
"text/javascript"
>
function here(sender, e) {
var win = GetRadWindow().BrowserWindow;
win.radopen(null, "win1"); // Open a window that is define in the radWindowManager of the parentPage
}
// Donne la référence d'une fenêtre radWindow
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
</
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadButton
ID
=
"but1"
runat
=
"server"
AutoPostBack
=
"false"
Text
=
"Click here Dude!"
OnClientClicked
=
"here"
>
</
telerik:RadButton
>
<
telerik:RadScriptManager
runat
=
"server"
></
telerik:RadScriptManager
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnNeedDataSource
=
"RadGrid1_needDS"
>
<
MasterTableView
AutoGenerateColumns
=
"false"
Name
=
"test"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"Id"
>
<
CommandItemTemplate
>
<
telerik:RadToolBar
ID
=
"RadToolBarGrid"
runat
=
"server"
OnClientButtonClicking
=
"here"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Add new"
ImageUrl
=
"~/Images/Add.png"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Id"
HeaderText
=
"Id"
UniqueName
=
"Id"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Title"
HeaderText
=
"Title"
UniqueName
=
"Title"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Style"
HeaderText
=
"Style"
UniqueName
=
"Style"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Rating"
HeaderText
=
"Rating"
UniqueName
=
"Rating"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
div
>
</
form
>
</
body
>
</
html
>
test.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace RadControlsWebApp5
{
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_needDS(object sender, EventArgs e)
{
List<
movie
> movies = new List<
movie
>();
movies.Add(new movie(1, "King Kong", "Action", "4/5"));
movies.Add(new movie(2, "The Black Knight", "Action", "4.5/5"));
movies.Add(new movie(3, "Harry Potter and the deadly hallow", "Fantasy", "4/5"));
movies.Add(new movie(4, "Inception", "Sc-fiction", "5/5"));
movies.Add(new movie(5, "Transformer : The revenge of the fallen", "Action, Sc-Fiction", "3/5"));
RadGrid1.DataSource = movies;
}
}
public class movie
{
public movie(int id, string title, string style, string rating)
{
Id = id;
Title = title;
Style = style;
Rating = rating;
}
public int Id { get; private set; }
public string Title { get; private set; }
public string Style { get; private set; }
public string Rating { get; private set; }
}
}
EDIT :
Sorry, I notice that the title just work fine in this example. In fact, I realize that if I set a title in the <title></title> in the head of a aspx page, this title come over the title of the window setting.