I've got a web page in my system that pops up when I double-click on a RadGrid row. This has been working fine.
This is based mainly on these examples:
http://www.telerik.com/community/forums/aspnet-ajax/window/customization-of-radwindow-through-clientside-javascript.aspx
and here:
http://demos.telerik.com/aspnet-ajax/window/examples/radopen/defaultvb.aspx
The JavaScript is called by the RadGrid in the client events, OnRowDblClick.
Now, what I'd like is to have a similar screen called by a button in the grid row. (For test purposes I am calling the same screen and JavaScript function.) To this end I have added a GridButtonColumn, ImageButton type, to the grid. In the C# code, in the ItemDataBound event, I have added the following code.
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
((ImageButton)item["PrintDoc"].Controls[0]).Attributes.Add("onclick", "printDoc(this," + item["Id"].Text + ");");
}
The JavaScript code is as follows:
function printDoc(sender, Id) {
var oWnd = window.radopen("PrintDoc.aspx?Id=" + Id, "Print Doc");
oWnd.SetWidth(600);
oWnd.SetHeight(400);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move +
Telerik.Web.UI.WindowBehaviors.Close +
Telerik.Web.UI.WindowBehaviors.Resize);
oWnd.show();
}
The Javascript code is getting called and receiving the correct data. The problem is that when called from the button, the window is just flickering on the screen for an instant before vanishing.
Suggestions?
This is based mainly on these examples:
http://www.telerik.com/community/forums/aspnet-ajax/window/customization-of-radwindow-through-clientside-javascript.aspx
and here:
http://demos.telerik.com/aspnet-ajax/window/examples/radopen/defaultvb.aspx
The JavaScript is called by the RadGrid in the client events, OnRowDblClick.
Now, what I'd like is to have a similar screen called by a button in the grid row. (For test purposes I am calling the same screen and JavaScript function.) To this end I have added a GridButtonColumn, ImageButton type, to the grid. In the C# code, in the ItemDataBound event, I have added the following code.
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
((ImageButton)item["PrintDoc"].Controls[0]).Attributes.Add("onclick", "printDoc(this," + item["Id"].Text + ");");
}
The JavaScript code is as follows:
function printDoc(sender, Id) {
var oWnd = window.radopen("PrintDoc.aspx?Id=" + Id, "Print Doc");
oWnd.SetWidth(600);
oWnd.SetHeight(400);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move +
Telerik.Web.UI.WindowBehaviors.Close +
Telerik.Web.UI.WindowBehaviors.Resize);
oWnd.show();
}
The Javascript code is getting called and receiving the correct data. The problem is that when called from the button, the window is just flickering on the screen for an instant before vanishing.
Suggestions?