Hi,
i used the custom sqlsitemapprovider which is in this web :http://msdn.microsoft.com/msdnmag/issues/06/02/wickedcode/default.aspx?loc=&fig=true#fig5 but in this sample they used sqlsitemapprovider as a default sitemapprovider i dont wanna use it as a default and i wanna send a paramater which is used to filter datas to that class. I modified that class and i can take a sitemapprovider back and i wanna show it a sitemappath data source programmaticaly. i wanna create an instance object of sitemappath datasource and i wanna bind it to that class and then i wanna add a treeview control to the page then i wanna bind it to the sitemapdatasource programmaticaly too..
Thanks for your attetion.
Regards...
Ok i made it
if you wanna learn how i made it :
just write them written below in the specified area :
in web.config:
<connectionStrings>
<add name="SiteMapConnectionString" connectionString="Data Source=.;Initial Catalog=Sorular;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<caching>
<sqlCacheDependency enabled="true"/>
</caching>
<siteMap>
<providers>
<add name="SiteMapBenYazdim" type="SqlSiteMapProvider" connectionStringName="SiteMapConnectionString"></add>
</providers>
</siteMap
codebehind:
SiteMapDataSource data = new SiteMapDataSource();
data.SiteMapProvider = "SiteMapBenYazdim";
TreeView1.DataSource = data;
TreeNodeBinding bind = new TreeNodeBinding();
bind.TextField = "Title";
bind.ToolTipField = "Description";
bind.ValueField = "Url";
bind.SelectAction = TreeNodeSelectAction.SelectExpand;
TreeView1.DataBindings.Add(bind);
That it man.i have been working on that damn thing about 2 days. And thanks God finally i made it..
treeVeriTabani.Provider = sitemap;
TreeKonular.DataSource = treeVeriTabani;
TreeNodeBinding alanlar =newTreeNodeBinding();alanlar.TextField ="Title";
alanlar.ValueField ="Url";alanlar.ToolTipField ="Title";
alanlar.SelectAction =TreeNodeSelectAction.SelectExpand;TreeKonular.DataBindings.Add(alanlar);
Page.DataBind();
Ok thats it
No comments:
Post a Comment