treeview 控件關(guān)鍵屬性
checkednodes                 聲明被選擇的單個或者多個節(jié)點
expanddepth                   聲明treeview控件展開的深度
nodes                               treenodecollection 類型的節(jié)點集合
selectednode                  當(dāng)前被選擇的節(jié)點
showcheckboxes           聲明是否顯示復(fù)選框
showexpandcollapse    聲明展示/折疊狀態(tài)
showlines                      聲明節(jié)點間是否以線連接
levelstyles                     指定每個層次的節(jié)點的樣式
nodestyle                       指定節(jié)點的默認(rèn)樣式
rootnodestyle              指定根節(jié)點的樣式
leafnodestyle               指定子節(jié)點的樣式
selectednodestyle        指定選定節(jié)點的樣式
hovernodestyle            指定當(dāng)鼠標(biāo)移在節(jié)點上方時的樣式
imageurl properties       指定表示展開/折疊的圖片的url路徑
treenode關(guān)鍵屬性
checked                             標(biāo)明節(jié)點上的復(fù)選框的選擇狀態(tài)
imageurl                             標(biāo)明節(jié)點上所用圖片的url路徑
navigateurl                       當(dāng)單擊節(jié)點時所要導(dǎo)航到的url路徑
selectaction                     無導(dǎo)航節(jié)點被單擊時所要執(zhí)行的動作
selected                             標(biāo)明當(dāng)前節(jié)點是否被選擇的節(jié)點
showcheckbox                 標(biāo)明當(dāng)前節(jié)點是否顯示復(fù)選框
text                                    節(jié)點上的文字
treeview 事件
checkchanged               當(dāng)復(fù)選框被選擇或者清除選擇時的所觸發(fā)的事件
selectednodechanged  當(dāng)選擇的節(jié)點發(fā)生改變時所觸發(fā)的事件
treenodecollapsed       當(dāng)分支被折疊時所觸發(fā)的事件
treenodeexpanded       當(dāng)分支被展開時所觸發(fā)的事件
treenodedatabound    當(dāng)節(jié)點被綁定到數(shù)據(jù)源時所觸發(fā)的事件
treenodepopulate*       fired when a populateondemand node needs content
* only fired on server if enableclientscript="false"
使用 selectednodechanged事件
<asp:treeview id="tree" onselectednodechanged="onupdate" runat="server">
  <nodes>
    
  </nodes>
</asp:treeview>
  .
  .
  .
<script language="c#" runat="server">
void onupdate (object sender, eventargs e)
{
    // get the text of the selected node
    string text = tree.selectednode.text;
      
}
</script>
按需裝載節(jié)點
<asp:treeview ontreenodepopulate="onpopulate" enableclientscript="false"
  runat="server">
  <nodes>
    <asp:treenode text="populate this node on demand"
      populateondemand="true" runat="server" />
  </nodes>
</asp:treeview>
  .
  .
  .
<script language="c#" runat="server">
void onpopulate (object sender, treenodeeventargs e)
{
    // called first time the populate-on-demand node is expanded
    treenode node = new treenode ("this node added dynamically");
    e.node.childnodes.add (node);
}
</script>
menu 控件關(guān)鍵屬性 
items                                          menuitemcollection 類型的菜單項的集合
itemwrap                                  specifies whether menu item should wrap
orientation                                標(biāo)明菜單是縱向排列還是橫向排列
selecteditem                             標(biāo)明當(dāng)前選擇的菜單項
staticstyle properties              標(biāo)明靜態(tài)菜單的樣式
dynamicstyle properties        標(biāo)明動態(tài)菜單的樣式
menuitem 控件關(guān)鍵屬性
imageurl                                    菜單項上所顯示圖片的url路徑
navigateurl                              當(dāng)菜單項單擊時所要導(dǎo)航的目標(biāo)路徑
selected                                    標(biāo)明當(dāng)前菜單項是否已經(jīng)被選中
text                                           菜單項上的文字 (顯示給最終用戶)
tooltip                                    當(dāng)光標(biāo)暫停或者移過菜單項時所顯示的提示文本
value                                         菜單項的實際值
menu事件
menuitemclick  當(dāng)菜單項被單擊時所觸發(fā)的事件
menuitemdatabound 當(dāng)菜單項被綁定到數(shù)據(jù)源時所觸發(fā)的事件
使用 menuitemclick事件
menuitemclick  當(dāng)菜單項被單擊時所觸發(fā)的事件
menuitemdatabound 當(dāng)菜單項被綁定到數(shù)據(jù)源時所觸發(fā)的事件
使用 menuitemclick事件
checked                             標(biāo)明節(jié)點上的復(fù)選框的選擇狀態(tài)
imageurl                             標(biāo)明節(jié)點上所用圖片的url路徑
navigateurl                       當(dāng)單擊節(jié)點時所要導(dǎo)航到的url路徑
selectaction                     無導(dǎo)航節(jié)點被單擊時所要執(zhí)行的動作
selected                             標(biāo)明當(dāng)前節(jié)點是否被選擇的節(jié)點
showcheckbox                 標(biāo)明當(dāng)前節(jié)點是否顯示復(fù)選框
text                                    節(jié)點上的文字
treeview 事件
checkchanged               當(dāng)復(fù)選框被選擇或者清除選擇時的所觸發(fā)的事件
selectednodechanged  當(dāng)選擇的節(jié)點發(fā)生改變時所觸發(fā)的事件
treenodecollapsed       當(dāng)分支被折疊時所觸發(fā)的事件
treenodeexpanded       當(dāng)分支被展開時所觸發(fā)的事件
treenodedatabound    當(dāng)節(jié)點被綁定到數(shù)據(jù)源時所觸發(fā)的事件
treenodepopulate*       fired when a populateondemand node needs content
* only fired on server if enableclientscript="false"
使用 selectednodechanged事件
<asp:treeview id="tree" onselectednodechanged="onupdate" runat="server">
  <nodes>
    
  </nodes>
</asp:treeview>
  .
  .
  .
<script language="c#" runat="server">
void onupdate (object sender, eventargs e)
{
    // get the text of the selected node
    string text = tree.selectednode.text;
      
}
</script>
按需裝載節(jié)點
<asp:treeview ontreenodepopulate="onpopulate" enableclientscript="false"
  runat="server">
  <nodes>
    <asp:treenode text="populate this node on demand"
      populateondemand="true" runat="server" />
  </nodes>
</asp:treeview>
  .
  .
  .
<script language="c#" runat="server">
void onpopulate (object sender, treenodeeventargs e)
{
    // called first time the populate-on-demand node is expanded
    treenode node = new treenode ("this node added dynamically");
    e.node.childnodes.add (node);
}
</script>
menu 控件關(guān)鍵屬性 
items                                          menuitemcollection 類型的菜單項的集合
itemwrap                                  specifies whether menu item should wrap
orientation                                標(biāo)明菜單是縱向排列還是橫向排列
selecteditem                             標(biāo)明當(dāng)前選擇的菜單項
staticstyle properties              標(biāo)明靜態(tài)菜單的樣式
dynamicstyle properties        標(biāo)明動態(tài)菜單的樣式
menuitem 控件關(guān)鍵屬性
imageurl                                    菜單項上所顯示圖片的url路徑
navigateurl                              當(dāng)菜單項單擊時所要導(dǎo)航的目標(biāo)路徑
selected                                    標(biāo)明當(dāng)前菜單項是否已經(jīng)被選中
text                                           菜單項上的文字 (顯示給最終用戶)
tooltip                                    當(dāng)光標(biāo)暫停或者移過菜單項時所顯示的提示文本
value                                         菜單項的實際值
menu事件
menuitemclick  當(dāng)菜單項被單擊時所觸發(fā)的事件
menuitemdatabound 當(dāng)菜單項被綁定到數(shù)據(jù)源時所觸發(fā)的事件
使用 menuitemclick事件
menuitemclick  當(dāng)菜單項被單擊時所觸發(fā)的事件
menuitemdatabound 當(dāng)菜單項被綁定到數(shù)據(jù)源時所觸發(fā)的事件
使用 menuitemclick事件
<asp:menu  onmenuitemclick="onclick" runat="server">
  <items>
    
  </items>
</asp:menu>
  .
  .
  .
<script language="c#" runat="server">
void onclick (object sender, menueventargs e)
{
    // get the text of the selected menu item
    string text = e.item.text;
      
}
</script>
treeview控件和 site maps 關(guān)系 
<asp:sitemapdatasource id="sitemap" runat="server" />
<asp:treeview datasourceid="sitemap" runat="server" />
menus控件和 site maps 關(guān)系
<asp:sitemapdatasource id="sitemap" runat="server" />
<asp:menu datasourceid="sitemap" runat="server" />
在配置文件中修改文件名 
<configuration>
  <system.web>
    <sitemap>
      <providers>
        <remove name="aspnetxmlsitemapprovider" />
        <add name="aspnetxmlsitemapprovider"
          type="system.web.xmlsitemapprovider, system.web, "
          sitemapfile="acme.sitemap" />
      </providers>
    </sitemap>
  </system.web>
</configuration>
<sitemapnode> 屬性 
description      節(jié)點的描述信息
roles                 指定當(dāng)前項對哪些角色是可見的*
title                   當(dāng)前項的標(biāo)題
url                    當(dāng)前項導(dǎo)航的目標(biāo)路徑
security trimming
<configuration>
  <system.web>
    <sitemap>
      <providers>
        <remove name="aspnetxmlsitemapprovider" />
        <add name="aspnetxmlsitemapprovider"
          type="system.web.xmlsitemapprovider, system.web, "
          sitemapfile="acme.sitemap" />
      </providers>
    </sitemap>
  </system.web>
</configuration>
<sitemapnode> 屬性 
description      節(jié)點的描述信息
roles                 指定當(dāng)前項對哪些角色是可見的*
title                   當(dāng)前項的標(biāo)題
url                    當(dāng)前項導(dǎo)航的目標(biāo)路徑
security trimming
description      節(jié)點的描述信息
roles                 指定當(dāng)前項對哪些角色是可見的*
title                   當(dāng)前項的標(biāo)題
url                    當(dāng)前項導(dǎo)航的目標(biāo)路徑
security trimming
<sitemap>
  <sitemapnode title="home" description="" url="default.aspx">
    <sitemapnode title="announcements" url="announcements.aspx"
      description="information for all employees" /> 任何人均可見
    <sitemapnode title="salaries" url="salaries.aspx"
      description="salary data" roles="managers,ceos" /> 只有manager
和ceo權(quán)限的可見
  <sitemapnode>
</sitemap>
使 security trimming生效 
<configuration>
  <system.web>
    <sitemap>
      <providers>
        <remove name="aspnetxmlsitemapprovider" />
        <add name="aspnetxmlsitemapprovider"
          type="system.web.xmlsitemapprovider, system.web, "
          securitytrimmingenabled="true"
          sitemapfile="web.sitemap" />
      </providers>
    </sitemap>
  </system.web>
</configuration>
sitemapdatasource屬性
<configuration>
  <system.web>
    <sitemap>
      <providers>
        <remove name="aspnetxmlsitemapprovider" />
        <add name="aspnetxmlsitemapprovider"
          type="system.web.xmlsitemapprovider, system.web, "
          securitytrimmingenabled="true"
          sitemapfile="web.sitemap" />
      </providers>
    </sitemap>
  </system.web>
</configuration>
sitemapdatasource屬性
provider                               用來獲得站點導(dǎo)航數(shù)據(jù)的provider
sitemapprovider                用來獲得站點導(dǎo)航數(shù)據(jù)的provider的名稱
showstartingnode             指定顯示為根節(jié)點的項
startfromcurrentnode     指定開始節(jié)點是否是根節(jié)點(false)或者是當(dāng)前節(jié)點(true)默認(rèn) = false
startingnodeoffset            使用層次來指定開始節(jié)點 (default = 0)
startingnodeurl                 使用url來指定開始節(jié)點
隱藏site map根節(jié)點
<asp:sitemapdatasource id="sitemap" showstartingnode="false"
    runat="server" />
<asp:treeview datasourceid="sitemap" runat="server" />
sitemappath控件關(guān)鍵屬性
currentnodestyle             當(dāng)前節(jié)點的樣式
currentnodetemplate     當(dāng)前節(jié)點的html模板
nodestyle                          非當(dāng)前節(jié)點的樣式
nodestyletemplate        非當(dāng)前節(jié)點的html模板
pathseparator                  分隔符所使用的文字 (默認(rèn) = ">")
pathseparatorstyle           分隔符的樣式
pathseparatortemplate  分隔符所使用的html模板
rootnode                         屬性用來鑒別根節(jié)點
currentnode                    屬性用來鑒別當(dāng)前節(jié)點
使用 site map api 
// write the title of the current node to a label control
label1.text = sitemap.currentnode.title;
// write the path to the current node to a label control
sitemapnode node = sitemap.currentnode;
stringbuilder builder = new stringbuilder (node.title);
while (node.parentnode != null) {
    node = node.parentnode;
    builder.insert (0, " > ");
    builder.insert (0, node.title);
}
  
label1.text = builder.tostring ();
新聞熱點
疑難解答
圖片精選