首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

自定义控件里的表格为什么不能使用控件的属性?来指教一下

2011-12-27 
自定义控件里的表格为什么不能使用控件的属性?高手进来指教一下!protectedoverridevoidRender(HtmlTextWri

自定义控件里的表格为什么不能使用控件的属性?高手进来指教一下!
protected   override   void   Render(HtmlTextWriter   output)
                {
                        StringBuilder   builder   =   new   StringBuilder( " ");
                        builder.Append( " <table   width=\ " "   +   this.page_width   +   "\ "   border=\ "0\ "   cellspacing=\ "0\ "   cellpadding=\ "2\ "   align=\ "center\ "   height=\ "22\ "   BackColor=\ "red\ "   > \n ");
                        builder.Append( "\t <tr> \n ");
                        builder.Append( " <td   height=\ "22\ "   width=\ "30%\ "   align   =   \ "left\ "> ");
                        builder.Append( " <font   color=\ "#000000\ "> ≡ "   +   this.table_Name   +   "≡ </font> ");
                        builder.Append( " </td> ");
                        builder.Append( "\t\t <td   width=\ "70%\ "> ");
                        builder.Append( "\t\t <div   align=\ "right\ "> \n ");
                        if   (this.page_All   !=   " ")
                        {
                                builder.Append( "\t\t\t[   <a   href= "   +   this.page_All   +   "> "   +   PageAllString   +   " </a>   ]&nbsp;\n ");
                        }
                        if   (this.Page_Add   !=   " ")
                        {
                                builder.Append( "\t\t\t[   <a   href= "   +   this.Page_Add   +   "> "+PageAddString+ " </a>   ]&nbsp;\n ");
                        }
                        if   (this.Page_Search   !=   " ")
                        {
                                builder.Append( "\t\t\t[   <a   href= "   +   this.Page_Search   +   "> "   +   PageSearchString   +   " </a>   ]&nbsp;\n ");


                        }
                        if   (this.page_Back   !=   " ")
                        {
                                builder.Append( "\t\t\t[   <a   href= "   +   this.page_Back   +   "> "   +   PageBackString   +   " </a>   ]&nbsp;\n ");
                        }
                        builder.Append( "\t\t </div> \n ");
                        builder.Append( "\t\t </td> \n ");
                        builder.Append( "\t </tr> ");
                        builder.Append( " </table> \n ");
                        output.Write(builder.ToString());
                }

这是我写的代码的一部分.我想在输出的表格中引用控件设置的背景色,但是没有成功!设置完没有任何反应.还有就是我在表格的BackColor属性中直接写上颜色也不行,求解!

[解决办法]
获得builder.ToString()的值,把它放到HTML页面试试。

热点排行