page.controls[0].controls還是page.controls[1].controls的區別

Page頁面是用控件樹的形式來組織的
如圖

page
    +--controls[0]
          +-----controls[0].controls
    +--controls[1]
          +-----controls[1].controls  

比如頁面上只有兩個DataGrid
那麼controls[0].controls是第一個DataGrid裏面的所有子控件
controls[1].controls是第二個DataGrid裏面的所有子控件

 

在page指令種添加如下內容可以看到控件樹!
<%@   Page   language= "c# "   Codebehind= "WebForm1.aspx.cs "   AutoEventWireup= "false "   Trace= "true "
添加:
Trace= "true "就可以了!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章