Home > Net >  C # a static method in the aspx dynamic map control or form, in a static method is feasible and can&
C # a static method in the aspx dynamic map control or form, in a static method is feasible and can&

Time:10-04

1, ASPX




2, c #
[the WebMethod]
Public static string drawCHK (string id)
{
HtmlStr +="& lt; Table width="400" border='1' cellpadding='1' cellspacing='1' & gt; ";
For (int I=0; I & lt; 5; I++)
{
HtmlStr +="& lt; Tr> " + dt. Rows [I] [0]. The ToString () + "& lt;/label> ";
}
HtmlStr +="& lt;/table> ";
LrCon. Text=htmlStr;

Return "OK".
}

CodePudding user response:

Trouble you to provide an effective way, didn't find the right online, practical examples

CodePudding user response:

In the dynamic method is easy to realize the function of in a static method can not make, we faced similar examples?

CodePudding user response:

Background have & lt;> This kind of character escaping into & amp; gt; & lt; The

CodePudding user response:

What is the effective solution? Front desk controls can dynamically generated

CodePudding user response:

Temporarily haven't good way, the data back to the js painting inside the table

CodePudding user response:

Linq + reapter
Aspx:
 












The column name & lt;/td>
The column name & lt;/td>
The column name & lt;/td>
<% # Eval (" checkbox ") % & gt; <% # Eval (" lable ") % & gt;


C #
 
Var DataSource=the from f in dt. AsEnumerable () to select the new
{
The checkbox="& lt; Input type='checkbox value=' "+ f.F ield (" column ") + "'/& gt;" ,
Lable="& lt; Label>" + f.F ield (" column ") + "& lt;/label>"
};
This. The RPT. The DataSource=DataSource;
RPT. DataBind ();
  • Related