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

invoke popup from code behind

2 Answers 217 Views
Window
This is a migrated thread and some comments may be shown as answers.
John Davis
Top achievements
Rank 2
John Davis asked on 06 Sep 2008, 12:02 PM

I need a function like the ShowAlert button in this demo
http://demos1x.telerik.com/aspnet/Window/Examples/BrowserDialogBoxes/DefaultCS.aspx

However instead of invoking a popup window by a button click, as in the demo, I want to invoke the popup window inside an IF statement in the code behind of a user control.
After the user clicks "Yes" or "Cancel" the value of this user selection needs to be returned to the IF statement in the code behind.

In other words, I need almost the same thing as the demo except the modal popup window needs to be triggered in the code behind instead of by the user clicking on a button.

More specifically, I am using a RadUpload. After the user selects (browses for) a file, I check the filename.  If the name is non-standard I want a modal popup to warn the user and ask if the user wants to proceed.

 protected void buttonUpload_Click(object sender, EventArgs e)
        {
           
           FileNameType fileType = (FileNameType)Enum.Parse(typeof(FileNameType), RadComboBoxUploadType.SelectedValue);

            foreach (UploadedFile file in RadUploadSCS.UploadedFiles)
            {
           
                string mg = msgFileOK(file.FileName, RadComboBoxUploadType.SelectedItem.Text);

                if (mg.Length > 0)
...Here I want to popup the window and get a yes/cancel response back from the user

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 08 Sep 2008, 07:18 AM
Hi John,

Such functionality goes out of the scope of the RadWindow control. Note that just like the standard confirm dialog (e.g. window.confirm()), radconfirm is created and handled on the client - after receving the result on the client you will have to send it somehow to the server - with ajax request or __doPostback().

Our suggestion is to implement your logic not by using RadWindow's radconfirm() but a standard confirm() dialog - once you have your code working as expected, the same logic will work with radconfirm as well.


Regards,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
SKS
Top achievements
Rank 1
answered on 29 Jan 2010, 09:36 PM
hey
this code doesnt work.
i am surprised telerik doesnt have a solution for this.
this is my scenario

i have an aspx page that has a button
the button click opens another aspx page in a radwindow
the radwindow has a button that has a server side handler in code behind.
when this button is clicked
some server side code needs to execute(in the code behind)
in the server side code if a condition is yes then this Radwindow has to open a radconfirm
based on the user reponse on the radconfirm
if Yes-Execute some server side code again
If No-dont do anything

to summarise

its a radconfirm in a radwindow and it needs to be invoked from code behind and the user response needs to be captured in code  behind and execute server side code based on the user response.

i have gone thru 100's of forums for this issue but it amazes me that telerik does not have a neat and clean solution for this.

Any help from shinu is greatly appreciated

thanks

~sks
Tags
Window
Asked by
John Davis
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
SKS
Top achievements
Rank 1
Share this question
or