一滴水


(:不快乐是一天,快乐也是一天哦:)

导航

单值数据绑定示例

Posted on 2005-04-09 03:38  一滴水  阅读(825)  评论(0编辑  收藏  举报
<HTML>
    
<HEAD>
        
<title>单值数据绑定示例1</title>
        
<script language="C#" runat="server">

            
void Page_Load(Object sender, EventArgs e)
            
{
                Page.DataBind();
            }

            
            string Message
{
                get    
{
                    
return "单值的数据绑定";
                }
    
            }

            
            
int MessageCount{
                get    
{
                    
return Message.Length;
                }

            }

            
        
</script>
    
</HEAD>
    
<body>
        
<form id="Form1" method="post" runat="server">
            
<P>
                
<asp:ListBox id="ListBox1" runat="server"></asp:ListBox>
                
<asp:TextBox id="TextBox1" runat="server" Text='<%# Message %>'>
                
</asp:TextBox></P>
            
<P>
                
<asp:Label id="Label1" runat="server" Text='<%# MessageCount %>'>
                
</asp:Label></P>
        
</form>
    
</body>
</HTML>