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

Need help generating popup from useconrol codebehind on dynamic button click whose url is dynamically generated based on textbox in RadGridItemCreated

3 Answers 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 26 May 2017, 12:35 AM

Need help generating popup from usercontrol codebehind on dynamic button click whose url is dynamically generated based on dynamic textbox in RadGridItemCreated

Most of the examples I find already know what to show in popup but in my case I want to show popup from codebehind based on whatever dynamic url I just create.

I will appreciate if anyone can reply to this.

3 Answers, 1 is accepted

Sort by
0
Gaurav
Top achievements
Rank 1
answered on 26 May 2017, 12:44 AM

Little more information I will do some javascript validation on button.OnClientClick and then button.Click += new EventHandler(nutton_Click) do all kinds of validation such as if user is trying to open an order belongs to him how many orderlines are there etc using SQL Stored procedure

Once everything looks good then I want to open radwindow with dynamically generated url

Please let me know if anything is unclear.

0
Accepted
Marin Bratanov
Telerik team
answered on 30 May 2017, 01:57 PM

Hello Gaurav,

I suggest you first get it to open as shown here: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/opening-from-the-server.

Then, you can add an argument to the registered script that will be the URL that you generate and provide it to the RadWindow either via its setUrl method, or when using radopen(). See this article on different ways to open a RadWindow: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/getting-started/opening-windows.

Here is a small snippet that seems the easiest way to do this to me:

string script = string.Format("function f(){{radopen('{0}', '{1}'); Sys.Application.remove_load(f);}}Sys.Application.add_load(f);", "the-url", "wndNameORnull");
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);

where you can tweak the two arguments to string.Format() according to your needs and, optionally, declare a named RadWindow in the RadWIndowManager that will have the desired options. You can also extend this to call a function on the page that will take more arguments and use more of the RadWindow client API.

Regards,

Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Gaurav
Top achievements
Rank 1
answered on 30 May 2017, 05:21 PM
Thank you
Tags
Grid
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Gaurav
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or