Tuesday 15 April 2014

asp.net - C# Repeaters while amending some figures -


I have a large finance table, which will be repeated 4 times on the page, on many different pages. I just do not like the idea of ​​copying the table across the page. Am I correct in thinking that I can make a repeater which repeats it? But at the same time the data in the backend is amended?

I have looked around, but it was not for sure whether the amendment in the figures is possible and more efficient as well?

  & lt; Div class = "span3 finance box" & gt; & Lt; Table class = "table-table-barbed table-hover finance-table" & gt; & Lt; TR & gt; & Lt; TD & gt; Title & lt; / TD & gt; & Lt; / TR & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; Figure & lt; / Td> & Lt; / Tr & gt; & Lt; TR & gt; & Lt; TD & gt; Title & lt; / TD & gt; & Lt; / TR & gt; & Lt; Tr & gt; & Lt; Td class = "fig" & gt; Figure & lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> & Lt; A href = "# financeDetail36" role = "button" class = "btn" data-toggle = "modal" & gt; Launch Finance Details & lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Div & gt;  

As I have understood from your explanation, many of you have only one part of HTML Repeat location of some cells with the difference of some values. So I suggest you make a new ASCX control.

Webusercontrol is similar to asp.net, but if there is a .ksx extension and can be put on page or other control, then add -> New item - & gt; Web user control in VisualStudio

The Web user control will have the markup file .ascx and the code-behind .ascx.cs file. Keep your html on the markup file:

  & lt; Div class = "span3 finance box" & gt; & Lt; Table class = "table-table-barbed table-hover finance-table" & gt; & Lt; TR & gt; & Lt; TD & gt; Title & lt; / TD & gt; & Lt; / TR & gt; & Lt; Tr & gt; & Lt; Td square = "fig" run = "server" id = "cell 1" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; TR & gt; & Lt; TD & gt; Title & lt; / TD & gt; & Lt; / TR & gt; & Lt; Tr & gt; & Lt; Td square = "fig" runat = "server" id = "cell2" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> & Lt; A href = "# financeDetail36" role = "button" class = "btn" data-toggle = "modal" & gt; Launch Finance Details & lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Div & gt;   

Now in the code-back you can access your cells by cell 1 and cell 2, and you can change your inline HTML by cell 1.inHMM property. You can create public assets in your code behind the file to gain access to these cells from this file:

  public string cell 1 text {get {return cell1.InterHTML}; } Set {cell1.InnterHtml = value; }}   

Then you can control your web user on your page. You can read more about this here:

In the end you will be able to access and modify your control properties by this piece of code: myUserControlName.Cell1Text = "NEW TEXT";

No comments:

Post a Comment