none
Pass QueryString to SP.UI.ModalDialog.showModalDialog(options) RRS feed

  • Question

  • Hi,

    I need to get some value from the current page QueryString and Pass it as QueryString again to the URL of SP.UI.ModalDialog.showModalDialog(options).  How to do this? Thanks


    Regards, Vikram

    Tuesday, April 1, 2014 8:07 AM

Answers

  • when you create the "options" object, put the querystring in URL parameter:

    to get the current querystring parameters, you can use the function: _spGetQueryParam("<lower case query key>")

    var a = _spGetQueryParam("key1");

    var b = _spGetQueryParam("key2");

    var options = SP.UI.$create_DialogOptions(); options.url = "http://site.domain.com/page.aspx?a=" + a + "&b=" + b; SP.UI.ModalDialog.showModalDialog(options);

    if you want to pass the entire queryString:

    options.url = "http://site.domain.com.page.aspx" + window.location.search



    • Proposed as answer by Michaelle de las Alas Tuesday, April 1, 2014 8:23 AM
    • Edited by Bruno2007 Tuesday, April 1, 2014 8:24 AM code added
    • Marked as answer by Vicky-SP Tuesday, April 1, 2014 8:57 AM
    Tuesday, April 1, 2014 8:21 AM

All replies

  • when you create the "options" object, put the querystring in URL parameter:

    to get the current querystring parameters, you can use the function: _spGetQueryParam("<lower case query key>")

    var a = _spGetQueryParam("key1");

    var b = _spGetQueryParam("key2");

    var options = SP.UI.$create_DialogOptions(); options.url = "http://site.domain.com/page.aspx?a=" + a + "&b=" + b; SP.UI.ModalDialog.showModalDialog(options);

    if you want to pass the entire queryString:

    options.url = "http://site.domain.com.page.aspx" + window.location.search



    • Proposed as answer by Michaelle de las Alas Tuesday, April 1, 2014 8:23 AM
    • Edited by Bruno2007 Tuesday, April 1, 2014 8:24 AM code added
    • Marked as answer by Vicky-SP Tuesday, April 1, 2014 8:57 AM
    Tuesday, April 1, 2014 8:21 AM
  • Exactly what i was looking for, thanks 

    Regards, Vikram


    • Edited by Vicky-SP Tuesday, April 1, 2014 8:58 AM
    Tuesday, April 1, 2014 8:57 AM