日期:2014-05-19  浏览次数:20368 次

程序与HTML分离时,还有没有办法将显示内容“直接”Response.Write到Panel(熟手请进)
程序与HTML混在一起时,实现起来很容易
<asp:Panel   id= "Pan "   style= "Z-INDEX:   101;   LEFT:   30px;   POSITION:   absolute;   TOP:   28px "   runat= "server "   Width= "268px "   Height= "306px "   BackColor= "#C0FFC0 ">
<%Response.Write( "aaaaaaa ")%>
</asp:Panel>
但在程序与HTML分离模式下,再也找不到这样直接的方法了,将Response.Write( "aaaaaaa ")写在Panel的任何事件中都不行。

我想得到的替代方法有:1、仍用程序与HTML混合模式;2、输出到单独一网页,在Panel中用iframe;3、在Panel中动态加诸如label控件,将内容输出到控件中。

方法2、3都不“直接”,回到方法1又实在不太甘心——类似Winform的编程模式难道在此夭折?

------解决方案--------------------
在panel中加LiterControl控件,设置LiterControl的Text属性
------解决方案--------------------
<%# DataBinder.Eval(Container.DataItem, "OPERATOR_CD ") %> 用这种方法进行绑定!
------解决方案--------------------
<asp:Panel id= "Pan " style= "Z-INDEX: 101; LEFT: 30px; POSITION: absolute; TOP: 28px " runat= "server " Width= "268px " Height= "306px " BackColor= "#C0FFC0 ">
<%Response.Write( "aaaaaaa ")%>
</asp:Panel>


=================>

aspx:
<asp:Panel id= "Pan " style= "Z-INDEX: 101; LEFT: 30px; POSITION: absolute; TOP: 28px " runat= "server " Width= "268px " Height= "306px " BackColor= "#C0FFC0 ">
<!--这儿是我们要输出内容的区域-->
<asp:literal runat= "server " id= "lit "/>
</asp:Panel>

cs:
在render之前对lit的text赋值
lit.Text= "aaaaaaaaa ";

没看出什么不 "直接 "
------解决方案--------------------
加一个 <div runat= "server " id= "divObject "> </div>

this.divObject.innerHTML= ".... ";