S
samarobrive
For a CMS, I use the treeview control with CSS friendly adapter binded with
the sitemap :
<asp:TreeView DataSourceID="SiteMapDataSource1" ID="EntertainmentTreeView"
runat="server" OnSelectedNodeChanged="OnClick"
OnAdaptedSelectedNodeChanged="OnClick" >
<DataBindings>
<asp:TreeNodeBinding DataMember="SiteMapNode" TextField="Title"
ValueField="url" />
</DataBindings>
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
But when I click on a node, the treeview does not respond, doesn't send
event. If I replace the ValueField "url" by for example "title", the event is
ok.
How can I force the treeview to send Event with ValueField="url" ?
You can see a sample at www.almageste.info/preuve2.zip.
Thanks for your help !
________
The page code is :
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
public void OnClick(Object sender, EventArgs e)
{
MessageLabel.Text = "You selected " +
EntertainmentTreeView.SelectedNode.Text + ".";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TreeView DataSourceID="SiteMapDataSource1" ID="EntertainmentTreeView"
runat="server" OnSelectedNodeChanged="OnClick"
OnAdaptedSelectedNodeChanged="OnClick">
<DataBindings>
<asp:TreeNodeBinding DataMember="SiteMapNode" TextField="Title"
NavigateUrlField="url" SelectAction="Select" />
</DataBindings>
</asp:TreeView>
<asp:Label ID="MessageLabel" runat="server" />
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>
And the Sitemapdatasource is:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="url1.aspx" title="url title 1" description="description 1"
/>
<siteMapNode url="url2.aspx" title="url title 2" description="description 2"
/>
</siteMapNode>
</siteMap>
the sitemap :
<asp:TreeView DataSourceID="SiteMapDataSource1" ID="EntertainmentTreeView"
runat="server" OnSelectedNodeChanged="OnClick"
OnAdaptedSelectedNodeChanged="OnClick" >
<DataBindings>
<asp:TreeNodeBinding DataMember="SiteMapNode" TextField="Title"
ValueField="url" />
</DataBindings>
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
But when I click on a node, the treeview does not respond, doesn't send
event. If I replace the ValueField "url" by for example "title", the event is
ok.
How can I force the treeview to send Event with ValueField="url" ?
You can see a sample at www.almageste.info/preuve2.zip.
Thanks for your help !
________
The page code is :
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
public void OnClick(Object sender, EventArgs e)
{
MessageLabel.Text = "You selected " +
EntertainmentTreeView.SelectedNode.Text + ".";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TreeView DataSourceID="SiteMapDataSource1" ID="EntertainmentTreeView"
runat="server" OnSelectedNodeChanged="OnClick"
OnAdaptedSelectedNodeChanged="OnClick">
<DataBindings>
<asp:TreeNodeBinding DataMember="SiteMapNode" TextField="Title"
NavigateUrlField="url" SelectAction="Select" />
</DataBindings>
</asp:TreeView>
<asp:Label ID="MessageLabel" runat="server" />
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>
And the Sitemapdatasource is:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="url1.aspx" title="url title 1" description="description 1"
/>
<siteMapNode url="url2.aspx" title="url title 2" description="description 2"
/>
</siteMapNode>
</siteMap>