SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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:

share|improve this answer
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.

share|improve this answer
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:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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