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

Dialogs - Reading Parameters at Server-Side

2 Answers 93 Views
Editor
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Jul 2008, 02:26 PM
Hi

I'm aware we can pass parameters over when open a dialog via javascript as below:



var editor = $find("<%=txtEditor.textEditor.ClientID%>");

var openArgs = {};

openArgs.sender =

'AppendixRule';

editor.fire(

'TP_EditRule', openArgs);




These parameters can then be read using javascript in the dialog. However I was wondering if there is a way to read these on the server side page load of the ASCX control? ie ...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'HERE

End Sub


Thanks
David

2 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 21 Jul 2008, 07:55 AM
Hello David,

Depending on whether the parameters you wish to pass are coming from the server or browser, there are two ways to do this. If your data comes from the browser, you can use the dialog's URL (querystring) to pass it to the server.
For example:

Telerik.Web.UI.Editor.CommandList.test  = function(commandName, editor, oTool) 
    var oldAdditionalQueryString = editor.get_dialogOpener().get_additionalQueryString(); 
    editor.get_dialogOpener().set_additionalQueryString("&MyItem=MyValue"); 
    editor.showDialog("test"); 
    editor.get_dialogOpener().set_additionalQueryString(oldAdditionalQueryString); 
    return false
}; 

The parameters can then be retrieved easily on the server:

protected void Page_Load(object sender, EventArgs e) 
    string param = Request.QueryString["MyItem"]; 
... 


If your parameters are coming from the server, then you can use the Session object to pass them from the parent page to the dialog control.


Best wishes,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 21 Jul 2008, 07:59 AM
Excellent, as usual thanks for your help.

David
Tags
Editor
Asked by
David
Top achievements
Rank 1
Answers by
Lini
Telerik team
David
Top achievements
Rank 1
Share this question
or