html - C# - Match Entity Property to String Value -


I am trying to generate an HTML table where both column counting and width can be optimized. I want to be able to tie columns in their respective columns ...

Example Schema :
[Invoice] [Quantity]
[Invoice] [ItemName]
[Invoice]. [Total Amount]

Originally, I was trying to pass along two properties (both dictionaries) in one property.

Something like this:

  Public class custom object {public dictionary & lt; String, int & gt; THTitle_width {get; Set; } Public Dictionary & lt; String, string & gt; InvoiceColumn_ChorrespondingTHTitle {get; Set; }}   

I want to achieve something like this:

  THTitle_Width.Add ("My Quantity Header", 100); InvoiceColumn_ChorrespondingTHTitle.Add ("Quantity", "My Quantity Header"); Ideas for data inside [invoice] [Quantity] column is then known to come under the table column "My Quantity Header", in return for a width of 100 (px).  

It will then output:

    

etc ...

Upon the reason, you can simply pass this custom object and handle everything beyond that. Is this possible? Maybe not in this way, but in the other?

Thanks for any help!

Finished using something like: (thanks to Stephen Hoffman)

  namespace samples {using the system; Using System.Collections.Generic; Using System.Data; Using System.Text; Public Category Sample {Public Fixed Zero Main () {Datatale Data = GetTable (); HtmlTable html = new HtmlTable () BindTolumn ("ID", "Ident", 64) .BindColumn ("name", "first name", 128) .band column ("description", "to know things", 256); Console.WriteLine (html.BuildHtml ()); Console.ReadLine (); } Private Static DataTable GetTable () {DataTable Table = New Datatile (); Table Column Add ("id", typef (int)); Table. Column Add ("name", typef (string)); Table Column Add ("description", typef (string)); Table. Column Add ("Date", Typef (DateTime)); Table. Secrets Add (1, "Alice", "Like Encryption.", Datetime. Now); Table. road. Add (2, "Bob", "To decrypt a lot.", Datetime. Now); Table. road. Add (3, "Charlie", "is not really strange", date-time.Now); Table. road. Add (4, "David", "knows how to use stones.", DateTime.); Table. Ro Add (5, "Elmer", "Do not mess with her, when worn ear wear.", Datetime.); Return table; }} Public Category HtmlTable {Private list & lt; HtmlTableColumn & gt; Column = new list & lt; HtmlTableColumn & gt; (); Private datatable datable = zero; Public HtmlTable BindTable (DataTable dataTable) {this.dataTable = dataTable; Back it; } Public HtmlTable BindColumn (string columnName, string captions, int width) {this.column.Add (new HtmlTableColumn () {caption = caption, columnname = column name, width = width}); Back it; } Public String BuildHtml () {StringBuilder Results = New StringBuilder (); // Create your HTML table return result. Toasting (); }} Public class HtmlTableColumn {public string caption {get; Set; } Get the public string columnname {get; Set; } Receive public int width { Set; }}}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -