I have an applicationPage who is open by Modal Dialog. I would like to read this params server side in the application page . I don't use the URL for passing parameter, i use the options.args

Is it possible??

sample code :

Javascript :

var options = {
  url: '/_layouts/MyApplicationPage.aspx',
  title: 'Title',  
  autoSize: true,   
  args: { arg1: 'arg 1', arg2: 123, arg3 : 'other arg'} // My params

Server side of MyApplicationPage.aspx

protected void Page_Load(object sender, EventArgs e){   
  // how to read arg1, arg2, arg3 ??

You probably won't be able to get the args in code-behind when you specify them within the options object. When working with the options object in Modal Dialog the args will be saved on client side only. Thus the server cannot get them.

To get these args you should modify your url like this:

var options = {
  url: '/_layouts/MyApplicationPage.aspx' + '?arg1=arg%201&arg2=123&arg3=other%20arg',
  title: 'Title',  
  autoSize: true,   
  args: { arg1: 'arg 1', arg2: 123, arg3 : 'other arg'}

This way you can get them with Request.Form["arg1"] As you can see, I did escape the arguments.

| improve this answer | |
  • yes, that what I have done to unblock me. Pass params in URL and read it with Request.QueryString["arg1"] – Nico May 18 '16 at 12:32
  • So to answer at my question, you can't read parameter (args) of Modal Dialog in C# :-( – Nico May 18 '16 at 12:34

Please try below line to get args from modal dialog


You can refer below mentioned link to get some more idea on it.

SharePoint: How to pass parameters into a Modal Dialog Window and then access them

Please let me know if it does not work.

| improve this answer | |
  • Thanks ! But the Request.Form["args"] is empty. The Application Page with the showModalDialog is open with GET methode not POST. I already read your link, You can read params with JavaScript Object Model but not in server side :-( – Nico May 18 '16 at 12:16
  • What happened? why "but the"? – Hardik May 18 '16 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.