code blocks are not supported in this context in asp.net control

前端 未结 2 1804
广开言路
广开言路 2021-01-17 14:12

I\'m creating one html table. I want to hide the table row. I\'m putting the attributes runat=server and id for the particular row, but the row has

2条回答
  •  忘掉有多难
    2021-01-17 14:16

    When you add a runat='server' to an HTML control you change the rendering and code blocks aren't supported inside. So if there are properties you need to change (style? class?) you probably have to instead of doing this:

    
         
            your code here
        
    
    

    Do something like this:

    >
         
            your code here
        
    
    

    Note: runat='server' removed from tr. Then in your codebehind you can do something like this:

    protected string GetRowProperties()
    {
        return "class='myclass'"; // something like this
    }
    

提交回复
热议问题