In my custom SharePoint 2010 web part, I am allowing the user to specify his information in a model dialog window. I then need to use this information in my web part code behind for further processing.

But I am not pretty sure as how to read this information back in my managed code.

Appreciate any help on this.


If your modal dialog was actually just a seperate


tag in your web part which was shown/hidden by the SharePoint dialog framework then you can just treat the controls in the dialog as you would any other control.

There is further info on rendering a div as a dialog here:


  • Thanks Charls for pointing me to that useful post, but I could not find the solution to my proble aka how to pass the values as computed by the ECMA model back to my managed code? – Vivek Sep 30 '10 at 1:33
  • If you NEED the values in your code behind then you could have your javascript populate a hidden control which passes the values back to your code behind. There is probably a cleaner way using services or callbacks, but this keeps it simple. – Charles Lee Sep 30 '10 at 15:35

Your modal dialogue could trigger a postback to the page and set the user-entered values put into the query string, which could be read by the web part.

  • Putting user entered data into the query string is not the securest method of transport, even in a cross page scenario. – Charles Lee Sep 29 '10 at 21:29

You can return values from a modal dialog by the use of 'commonModalDialogClose()'.

Here you can find an example how to do so: http://www.itidea.nl/index.php/a-better-user-experience-with-the-dialog-framework-and-notifications/

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.