Tuesday 15 April 2014

asp.net - Repeating a HTML table with C#, while populating different values -


I have a large finance table, which will be repeated on page 4 times on many different pages on the website.

I just do not like the idea of ​​copying the table on one page. So I want to call it at once, perhaps using a control. And then populate the tables four times, define the set values ​​in the .cs backend. ?

a) Can this be done?

b) I have read articles on repeaters, figures, grids, how should anyone take me directly?

  & lt; Div id = "finance-box" class = "span3" & gt; & Lt; Table class = "table" & gt; & Lt; Tr & gt; & Lt; Th & gt; 36 month PCP & lt; / Th & gt; & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td colspan = "2" & gt; & Lt; Img src = "/ images / 1" alt = "Mitsubishi Mirage PCP" /> & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "title" & gt; Price on The Road & lt; Span & gt; (V. VAT) & lt; / Span & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; & Amp; Pound; 12 9.00 & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "title" & gt; Deposit & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; & Amp; Pound; 2,514 & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "title" & gt; Monthly payment & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; & Amp; Pound; 12 9.00 & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "title" & gt; Representative APR & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; 6.7 & amp; nbsp; # 37; & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "title" & gt; Agrement duration & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; 36 months & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> & Lt; A href = "# financeDetail36" role = "button" class = "btn btn-threat" data-toggle = "modal" & gt; Launch Finance Details & lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt;    

Did you put it in a new UserControl? You can have an ANIM to load four different types of data, there is a public property to specify the enum, except the user control, you need the table, and then specify the property in the markup, so it knows That's what data to load. UserControls are the easiest way to reuse the webform.

No comments:

Post a Comment