load control on click

kyle shapiro asked on February 12, 2016 21:16

Hello DevNet. Is there a good way to say "don't load this map webpart until the user clicks a button"? or some other condition like "only load this webpart if on page xyz"? My website is running very slowly because I'm telling it to load tons of data, most of which is only needed on certain pages, or after the user clicks a button. Sorry for the broad question. I'm sure there are many different answers. Thank you.

Correct Answer

Virgil Carroll answered on February 13, 2016 17:48

Understood. My only other suggestion would be to tie your display of data to a datasource control. You could only populate the datasource using a QueryString value (use a Macro to grab the value), you could add a button that would reload the page and pass that QueryString value to load the data, otherwise the control would not load anything. Not the most elegant solution, but barring doing custom programming, this would work for you.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Virgil Carroll answered on February 12, 2016 21:36

You set some criteria on the 'visible' option in the web part configuration. Depending on what you are trying to tie this to, you might be able to use the out of the box macros to make visible only on a particular page (Macro around Page Node ID equally a particular value) or based on some other criteria

Doing the button click would be a bit more difficult, but you could create your own control with the grid and button and set your own load based on the button click, or you could put a button on a page and when clicked you could either go to the page of the data or bring it up in a modal window at that time.

Hope these give you a few thoughts.

0 votesVote for this answer Mark as a Correct answer

kyle shapiro answered on February 13, 2016 00:01

Virgil, What I am currently doing is toggling that visible property based on a macro, but the data is still fetched from the server for whatever is inside that webpart. Maps for example take a lot of resources, and even if it's not visible on my page, it's increasing my page load time.

0 votesVote for this answer Mark as a Correct answer

kyle shapiro answered on February 15, 2016 16:11

Thank you Virgil. I'll try this.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.