Why would my table generated by html generic in c # put it as text and not as an html element?

0

Currently I want to generate a few rows in a table depending on the images I have stored in a location, only when I want to concatenate everything with a innerhtml it is generated as text by the structure of the table.

This is seen in the browser element inspector

Table code:

public void btnOk_T_Onclick(object sender, EventArgs e)
        {


             DirectoryInfo d = new DirectoryInfo(@"C:\Users\Ned-Design\Documents\projects\NederaV4\Administrators\Temp");//Assuming Test is your Folder
            FileInfo[] Files = d.GetFiles("*.png"); //Getting Text files
            System.Web.UI.HtmlControls.HtmlGenericControl createDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("TABLE");
            createDiv.ID = "createTable";
            foreach (FileInfo file in Files)
            {

                //createDiv.ID = "createDivM";
                //createDiv.InnerHtml = " <img src=Temp" + "\" + file.Name + " style='width:100%;margin-top:2%'> ";
                //this.Controls.Add(createDiv);
                //createDiv.Attributes["class"] = "col-md-4";

                createDiv.InnerHtml +="<tr>< td ></ td >< td ></ td >< td ></ td >< td ></ td >< td ></ td > < td ></ td ></ tr >";

                conta++;
            }
            this.Controls.Add(createDiv);
        }
    
asked by David 18.05.2018 в 16:54
source

1 answer

0

Use this, it will be better, it also works for JavaScript:

ClientScript.RegisterStartupScript(this.GetType(), "render", "el html aqui");
    
answered by 19.05.2018 в 08:23