小编Dmi*_*ryK的帖子

在创建动态表时应用Css样式

这是我的问题:

  • 当我在C#中创建表时,我想为每个单元格添加不同的CSS样式.

    while(DR.Read()){

        TableRow linha1 = new TableRow();
        cel1 = new TableCell();
        cel2 = new TableCell();
        cel3 = new TableCell();
        cel4 = new TableCell();
    
        cel1.Controls.Add(new LiteralControl(DR.GetValue(0).ToString()));
        cel2.Controls.Add(new LiteralControl(DR.GetValue(1).ToString()));
        cel3.Controls.Add(new LiteralControl(DR.GetValue(2).ToString()));
        cel4.Controls.Add(new LiteralControl(DR.GetValue(3).ToString()));
    
    
        linha1.Controls.Add(cel1);
        linha1.Controls.Add(cel2);
        linha1.Controls.Add(cel3);
        linha1.Controls.Add(cel4);
        Tab_artigos_all.Controls.Add(linha1);
    }
    
    Run Code Online (Sandbox Code Playgroud)

css c# asp.net

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net ×1

c# ×1

css ×1