Static ASPx Webpage to dynamic Webpage

Posted on 2013-10-15
Medium Priority
Last Modified: 2013-10-28
Hello Experts...

Static Webpage layout

I have a website that currently has a hardcoded page layout as follows:

Column1                   Column2                        Column3

Heading1                  Heading2                        Heading3
      Report1                  Report2                        Report3

Heading4                  Heading5                        Heading6
      Report5                  Report6                        Report7
      Report8                  Report9

Can you recommend a way for me to do this dynamically so an end user can define the  different headings and what reports  can go under which heading?  All data is stored in a database.  The report will always be a pdf file.

Thank you,

Question by:the_b1ackfox
  • 3
  • 3
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39575962
As I see it you should have 3 tables:
1. Reports  -> your current reports table that should have an ReportId column
2. ReportsGroups  -> ReportsGroupId; UserId; GroupName;
3. ReportsGroupsRelation  -> ReportsGroupId; ReportId;

To manage this just list all reports with a dropdown in front. This dropdown holds the available ReportGroups. Leave a blank option on this dropdown for the cases when the user don't want to see the report anywhere.

This can also be done only with one ReportsGroups table:
ReportsGroups  -> ReportsGroupId; UserId; GroupName; ReportId;

In this case you need to get the Distinct list of groups by user to give the options to the user and be aware of case sensitivity and spelling issues.
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39575976
Another customizations point you can give to the users if the group position.
For this just add another column to the ReportsGroups table:

2. ReportsGroups  -> ReportsGroupId; UserId; GroupName; GroupIndex

Use this column in the ORDER BY of the query that gets the user reports.

Author Comment

ID: 39588197
Hello AlexCode,

Thank you for your response.  I can get the data to change dynamically, but I am trying to get the (currently static) web page to be dynamic as well.  So if the user sets their page to have only 3 headings, thats what they see.  Another user would see the 6 heading they selected and so on.

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.


Author Comment

ID: 39588457
I think I see how to do it,  I can't seem to sit by idle,  lol.  I found this code snippet it deals with VB, but it gives me what I think I needed(And no, I am not trying to do this with text boxes)  My comment are after the line of *******:


Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    ' Create dynamic controls here.
    TextBox1 = New TextBox()
    TextBox1.ID = "TextBox1"
    TextBox1.Style("Position") = "Absolute"
    TextBox1.Style("Top") = "25px"
    TextBox1.Style("Left") = "100px"

    TextBox2 = New TextBox()
    TextBox2.ID = "TextBox2"
    TextBox2.Style("Position") = "Absolute"
    TextBox2.Style("Top") = "60px"
    TextBox2.Style("Left") = "100px"

    ' CODEGEN: The Web Form Designer requires this method call.
    ' Do not modify it by using the code editor.
End Sub

So if I loop through a block of code like above based upon the SQL query, I should be able to have dynamic web pages based upon the users desire/design...  I will try and test this today!

LVL 30

Accepted Solution

Alexandre Simões earned 2000 total points
ID: 39588514
You can use the ASP.net template language to generate your html dynamically at page load: <% %>

For instance, if on the page code behind you have a public property that returns a List<String>:
public List<String> Names { get { return new List<string>() { "Name 1", "Name 2", "Name 3" }; } }

Open in new window

You can add the following to generate a list of those name in a <ul>:
<% foreach (var name in Names) { %>
     <li><%= name %></li>
<% } %>

Open in new window

Try it...

You can now apply the same logic but with your reports, generating items based on the user configuration.

Keep me posted! :)

Author Comment

ID: 39605914

You got me close enough to see a solution.  Thank you for helping me pierce the veil!


Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question