ASP.NET MVC2 - Dynamic Page Creation

I am kind of new to the world of ASP.NET (especially MVC), I am trying to build up a page based on the configuration below:

   <headInput>
    <defaultColumns>
      <column name="Shift" validation="" unit="" required="" />
      <column name="Level" validation="" unit="" required="" />
      <column name="Value" validation="" unit="" required="" />
      <column name="Time" validation="" unit="" required="" />
    </defaultColumns>
    <additionalCols1>
      <column name="Rate" validation="" unit="" required="" />
    </additionalCols1>
    <additionalCols2>
      <column name="Online" validation="" unit="" required="" />
      <column name="Type" validation="" unit="" required="" />
    </additionalCols2>
   </headInput>

I have been trying to understand on how I can use the above configuration to generate labels as columns and then generate the row with data in columns.

I tried looking at many examples but haven't been able to figure out if it is even possible or not. Any help would be appreciated.

Thanks.

Answers


I'm not sure what you're trying to do or what schema you're using in the example above, but my feeling is that you should be using HTML tables for this:

http://www.w3schools.com/html/html_tables.asp

http://www.w3.org/TR/html4/struct/tables.html

Tables are defined in rows, not columns, first with the heading row ( then the data rows then the table data .

Also look at the colspan attribute and the rowspan attribute which I think you'll need for this - lets columns span more than one row and rows span more than one column.

Also if you're learning MVC why are you using a 2 year old version?? MVC3 was released over a year ago and MVC 4 is in beta with a go-live license. We're using MVC 4 to develop a web based stock trading application and its solid as a rock.

There's an example of building an HTML table using MVC at http://www.asp.net/mvc/tutorials/older-versions/models-(data)/displaying-a-table-of-database-data-cs (scroll to the bottom to see the MVC view) Its basically HTML with some server tags for pulling the data from the model. That's how MVC is - very different from webforms where you'd have server controls generating HTML for you.


Looks like you need to generate HTML based on the XML input. You can use XSLT to do that.

Your MVC model should provide the XML and the View should use the XSLT to convert it to the HTML

here are few links which might be helpful -

http://www.htmlgoodies.com/beyond/xml/converting-xml-to-html-using-xsl.html

http://www.4guysfromrolla.com/webtech/081300-2.shtml


Need Your Help

static_cast restricts access to public member function?

c++ templates inheritance access-modifiers static-cast

I'm getting "error: ‘A’ is an inaccessible base of ‘B’" in static_cast of the following example:

java.lang.IllegalStateException: Activity has been destroyed Exception

android android-fragments android-viewpager

I'm implementing an application playing video. There are 2 activities: MainMenuActivity (in portrait mode) and VideoPlayerActivity(can rotate) . MainMenuActivity has HomeFragmentLT fragment. In

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.