7 Answers, 1 is accepted
Hi Dhananjay,
Here is a simple web part code demonstrating opening of a new RadWindow when an ASP.NET button is clicked.
Let us know if you have problems implementing the code.
Sincerely yours,
Dimitar Milushev
the telerik team
Can you please give some example for returning values from RadWindow to a SharePoint Web Part .
Below is the code that i have written and i am getting a javascript error : "OnClientClose" is undefined.
windowManager =
new RadWindowManager();
// windowManager.RadControlsDir = "/wpresources/RadControls";
windowManager.VisibleStatusbar=
false;
windowManager.ReloadOnShow =
true;
Button submitButton = new Button();
submitButton.Text =
"Show window";
submitButton.ID =
"popupButton";
refreshName.ContentTemplateContainer.Controls.Add(submitButton);
popupWindow =
new RadWindow();
popupWindow.ID =
"RadWindow1";
popupWindow.Behaviors=
WindowBehaviors.Close;
popupWindow.OnClientClose =
"javascript:OnClientClose(this)";
popupWindow.Width =
Unit.Pixel(500);
popupWindow.Height =
Unit.Pixel(300);
popupWindow.OpenerElementID = submitButton.ClientID;
// popupWindow.RadControlsDir = "/wpresources/RadControls";
ArrayList al = new ArrayList();
al.Add(
"A");
al.Add(
"B");
al.Add(
"C");
string items = String.Join(",", ((string[])al.ToArray(typeof(String))));
// Response.Redirect();
popupWindow.NavigateUrl =
"/_layouts/PWESearch/SearchCriteria.aspx?items=" + items + "&sDataType=Well";
refreshName.ContentTemplateContainer.Controls.Add(popupWindow);
//windowManager.Windows.Add(popupWindow);
refreshName.ContentTemplateContainer.Controls.Add(windowManager);
String OnCloseFunction = @"function OnClientClose(oWnd)
{
//get the transferred arguments
alert(oWnd.argument);
var arg = oWnd.argument;
if(arg)
{
alert(arg.searchCriteria);
var searchCriteria = arg;
$get('ctl00_m_g_68b8bae8_7d94_475f_be4e_5d5cfc056505_pnlSearchCriteria').innerHTML = 'You search Criteria is <strong>' + searchCriteria + '</strong>';
}
} "
;
ScriptManager.RegisterStartupScript(this, typeof(SayHelloWebPart), "OnCloseFunction", OnCloseFunction, true);
Please help me in getting over this problem.
Thanks & Regards,
Arun Kumar P
Try setting
popupWindow.OnClientClose ="OnClientClose";
Note that all eventhandlers - OnClientClose, OnClientShow, OnClientPageLoad, etc., accept the name of the function only. The declared function itself automatically gets the RadWindow object as an argument
e.g.
function OnClientClose(oWnd)
{
//your code here
}
Best wishes,
Georgi Tunev
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.
I am trying to use RadWindow on a SharePoint web part, but the code that is attached on this thread is not working (the popup is just nor firing)
Also I saw that some attributes (like RadControlsDir) doesn't exists on the version that I am using - RadControls for ASP.NET AJAX Q1 2010
Is there any change to provide an up to date example?
Tks,
Alex
This thread is quite old (from 2006) and it is related to the ASP.NET edition of the RadWindow control - that is why some of the properties are missing.
As for the code, could you please post it again, so I can check it?
Best wishes,
Georgi Tunev
the Telerik team
I was rechecking the code attached to this thread and it really worked. I just mixed the attribute "ClientID" with "ID". My only issue now is that the button will fire the radwindow every time it is clicked.
I would like to put some business logic on my button code, and depending on one condition of my logic the rad window would show up or not.
Is that possible?
Tks,
Alex
In your case I recommend you to use this approach in order to open a new RadWindow (radalert is an RadWidnow) from the server.
Greetings,
Fiko
the Telerik team
