初尝MultiView and View

 

1、MultiView是多个view的容器,通过ActiveViewIndex属性来指定显示哪个view的内容。

2、比如我想在一个页面里显示天气预报、股票行情、日期表等等,天啊,在一个页面同时显示这些,显得太眼花缭乱了。MultiView  and View可以让你想知道天气情况好决定是否出去玩,页面只显示天气预报的内容;如果你想看看你买的股票涨了吗,同样你可以通过一个下拉框轻松转到股票行情的内容来,必须说明这不是超链接之类的东西,它们同处一个页面,尽管内容变来变去,浏览器到url都没改变!
具体可以看一下:
http://quickstart.developerfusion.co.uk/QuickStart/aspnet/samples/ctrlref/standard/MultiView/MultiView1_vb.aspx
它的代码在这里:http://quickstart.developerfusion.co.uk/QuickStart/aspnet/doc/ctrlref/standard/multiview.aspx
呵呵,顺便帮developerfusion做个广告,不过说真的“这个网站很好,很强大”!


3、跟接下来的东西比,上面所讲的根本算不了什么。类似于注册论坛,经常遇到填完了一页又进入另一页。View与View之间可以传递信息,就是说你在View1填的信息可以在View2处理。比如我在View1参加了一个测试,在View2可以显示我得几分,因为它们都在同一个页面,就像普通的控件之间传递参数一样。
代码:

<% @ page language="C#"  %>

< script  runat ="server" >
void Button1_Click(object sender, System.EventArgs e)
{
    
this.LB_Name.Text = this.TB_Name.Text;    
    
this.MultiView1.ActiveViewIndex = 1;
}

    
void Button2_Click(object sender, System.EventArgs e)
    
{
        
this.Label1.Text = this.TB_Name.Text + "hello!!!";
        
this.MultiView1.ActiveViewIndex = 2;
    }

    
</ script >

< html >
< head  id ="Head1"  runat ="server" >
    
< title > Untitled Page </ title >
</ head >
< body >
    
< form  id ="Form1"  runat ="server" >
        
< asp:multiview  id ="MultiView1"  runat ="server"  activeviewindex ="0" >
            
< asp:view  id ="View1"  runat ="server" >
                Please enter your name:
                
< br  />
                
< br  />
                
< asp:textbox  id ="TB_Name"  runat ="server" >
                
</ asp:textbox >
                
< asp:button  id ="Button1"  runat ="server"  text ="OK"  onclick ="Button1_Click"   />
            
</ asp:view >
            
< asp:view  id ="View2"  runat ="server" >
                Your name is
                
< asp:label  id ="LB_Name"  runat ="server"  Width ="144px" > Label </ asp:label >
                
< asp:Button  ID ="Button2"  runat ="server"  Text ="Button"   OnClick ="Button2_Click" /></ asp:view >
            
< asp:View  ID ="View3"  runat ="server" >
                
< asp:Label  ID ="Label1"  runat ="server"  Text ="Label"  Width ="232px" ></ asp:Label ></ asp:View >
        
</ asp:multiview > &nbsp;&nbsp;

    
</ form >
</ body >
</ html >

4、真正让 MultiView  and View发挥威力的是移动设备编程,单单说它取代了以前的mobileform控件就知道它的厉害了。
说到这里,不禁要发个牢骚,ms的东西什么都好就是变化快得太离谱了,我用vsnet2003(asp.net1.1)做了个师生互动网站,现在把它升级为asp.net2.0,刚升级完vsnet2008(aspnet3.0)又炒上天了~~~
升级就升级嘛,也应该高版本的向下兼容低版本的啊(途径应该有,望知道的告知一下啊,这里谢谢先了,重写代码的感觉比当时创造它的时候很要痛苦万分),它现在升级把以前版本的很多控件、元素不是改得面目全非就是干脆放弃不用了! 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值