load a repeater data only when requested

Farah El Agha asked on March 12, 2018 12:53

hello, I have a repeater with big amount of data (texts, media, files an videos) related to each year , where years are displayed in a different repeater. the years repeater and data repeater are linked together so whenever a year is selected, its data are shown in the div. the problem is because the amount of data is huge, I want the page to only load the data if the associated year (with matching dataItem index) is selected, since it is affecting the performance and extend the page loading time to an unacceptable limit. Does anyone have an idea on how to accomplish this? and if there is a need for ajax?

Recent Answers


Peter Mogilnitski answered on March 12, 2018 15:30

Did you take a look at Dynamic jQuery AJAX viewer

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on March 12, 2018 15:39

No I dont think this is what I need since I already built the data repeater in a way that contains each data type in a nested repeater (each has its own transf.), isnt there another way than changing the repeater structure?

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 13, 2018 04:34 (last edited on December 10, 2019 02:31)

I'm slightly confused. Are you saying your "large" repeater shows all years, but you really only want it to show 1 year (depending on a drop down)?

If so, then i would have the year drop down set a URL parameter (?year=2018) when selected, and leverage that parameter in your repeater's where condition

WHERE: DataYear = {% Convert.ToInt(QueryString.Year, 0) |(identity)GlobalAdministrator%}

Then lastly you can set a macro on the Visible field of the repeater web part (hit the black arrow) and set it to only be visible if a year is present: Convert.ToInt(QueryString.Year, 0) > 0

If that's not the case, can you explain a little more?

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on March 13, 2018 12:51

No I dont think you got this right, I have two repeaters , one shows a selected year, and the other shows the data of that year, my only problem is that the second repeater (that contains the data), is loading all the data on page load. I want to load the data whenever the corresponding year is selected.

0 votesVote for this answer Mark as a Correct answer

Janiek Colpaert answered on March 14, 2018 16:57

Can you provide us with a screenshot of that page? Don't understand why you have a repeater to just show one year.

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on March 15, 2018 07:51

Screenshot

0 votesVote for this answer Mark as a Correct answer

Janiek Colpaert answered on March 15, 2018 09:38 (last edited on December 10, 2019 02:31)

I think you can go with the answer Trevor provided.

In the first repeater (years), add a url parameter (like: lade.org/home?year=2017) to the link with the value of the year on each item.

In the second repeater, just filter the data on the given url parameter on the where field like: WHERE: DataYear = {% Convert.ToInt(QueryString.Year, 0) |(identity)GlobalAdministrator%}

0 votesVote for this answer Mark as a Correct answer

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