-
Dynamic Includes?
Is it possible to build include statement dynamically? Let me try and explain what I need to do as best I can. The user will conduct a search and be able to select multiple results to print reports of. There are a possibility of about 10 different reports that they can select to print. I give them a list of the id's that they have selected (in a DG with checkboxes for multiple selections) then another DG with the list of different reports. So they select the ids they want, then select the report and hit an "Add to Queue" . Once they have selected all the reports they want I want to go to the next page and display all the reports on the page so they can just print em all on one page.
So what I have come up with (in my mind) is something like this, I will have 3 Str Variables that will contain the reports, id's and total reports. So I will prolly split those and create an array. Then loop thru the array with the includes.
Code:
dim strReport(20) as string
dim strId(20) as string
dim intTotalRpts as integer = Session("totreports")
strReport=Split(Session("reports"),",")
strId=Split(Session("ids"),",")
for i=0 to intTotalRpts
<--!# Include file=<%=strReport(i) & "?ids=" strId(i)%> -->
next
Thats kinda what I had in my mind. If anyone can shed some light on this that would be great.
-
Try using a LiteralControl. The text you place in it can be html and text. If you set the text to your include, it probably won't show because it is html, and might just work. I am not 100% sure on that, it is a theory...lol.
Please come back and tell if it works... it would be nice to know for future references.
-
Or, use controls instead of includes. Then you can dynamically add them to your page.