|
what shuld be the process flo in this... i never used treeview with datasource
i only used with javascript..
|
|
|
|
|
Sachin Dubey wrote: Hi All friends..
I Have 2 tabels for categories and subcategories..
Which i have to show by Treeview control.. i have some restrictions that i cant use javascript.
And i have to use object datasource..
What is your question ? Do you want to bind the data from database into table or what ?
|
|
|
|
|
yes i want to bind data from db only but only using objectdatasource..
how can i handel the node click to show subcategories..
|
|
|
|
|
You can't use ObjectDataSource here. A tree view supports only data source that implements IHierarchicalDataSource .
|
|
|
|
|
Is It Any Control like object datasource or anything else...
|
|
|
|
|
Try This Link It MAy Help..!
[^]
|
|
|
|
|
Get the result set in a Collection Object and loop through it.
1) First, get the dataset in Businesslayerclass as below:(eg:businessclass name is Employee)
public static Collection <Employee>GetData()
{
Collection<EmployeeData>empcollection = new Collection<EmployeeData>();
foreach (DataRow datarow in dataset1.Table[0].Rows)
{
}
}
2) In UI, call this method as below:
Employee emp = new Employee();
Collection<Employee>empcollection = new Collection<Employee>();
foreach (Employee emp1 in empcollection)
{
TreeNode tn = new TreeNode(emp1.Name)
tn.OnPopulateDemand = true;
TreeView1.Nodes.Add(tn);
}
Hope this helps.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
That comes closer but your code will only add nodes at the root level. This will not give hierarchical structure. To get a hierarchical structure, you should have some mechanism to identify the nodes parent and child nodes.
I have answered a similar question a while back. See here[^] if you are interested.
|
|
|
|
|
Are you aware about the existence of documentation?[^]. Here is what it says:
The TreeView control can also be bound to data. You can use either of two methods to bind the TreeView control to the appropriate data source type:- The TreeView control can use any data source control that implements the IHierarchicalDataSource interface, such as an XmlDataSource control or a SiteMapDataSource control. To bind to a data source control, set the DataSourceID property of the TreeView control to the ID value of the data source control. The TreeView control automatically binds to the specified data source control. This is the preferred method to bind to data.
- The TreeView control can also be bound to an XmlDocument object or a DataSet object with relations. To bind to one of these data sources, set the DataSource property of the TreeView control to the data source, and then call the DataBind method.
|
|
|
|
|
Better If you use xml.
Create a xml file xtracting data from both the table(Suppose filename is x.xml)
<menu type="root" value="HOME" url="~/Accounts/Index1.aspx">
<submenu type="folder" value="Fruits">
<state type="document" url="~/HR/a.aspx" value="Apple"/>
<state type="document" url="~/HR/b.aspx" value="Mango"/>
<state type="document" url="~/hr/c.aspx" value="Grapes"/>
</submenu>
</menu>
Add a treeview Control on your form page
in page_load section paste following codes:
In CodeBehindfile
XmlDataSource obxlmAdditional = new XmlDataSource();
obxlmAdditional.DataFile = "/x.xml";
treeMenu.DataSource = obxlmAdditional;
treeMenu.DataBind();
|
|
|
|
|
I am binding to the Gridview as follows:
BusinessUnitPartsGrid.DataSource = GetBusinessUnitsForParts(partnumberstring, ProjectId);
BusinessUnitPartsGrid.DataBind();
//GetBusinessUnitsForParts returns a dataset.
After this, I am doing as below:
foreach (GridViewRow gvr in BusinessUnitPartsGrid.Rows)
{
if (gvr.Cells[0].Text.Trim() == " ")
{
gvr.BackColor = Color.Red;
}
}
However, control never comes inside this loop because when I checked BusinessUnitPartsGrid.Rows.Count, it is 0. However, there are actually 5 rows and all the 5 are displaying in UI. What's happening here? Am I doing something wrong in the above code? Please help.
Thanks
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
If you are binding GridView in PageLoad, then you have to take care of PostBack.
From next time, post code in Code Block tag.
|
|
|
|
|
This is not in pageload event. Actually,there is a Wizard control and when clicking on last but-one Next button, I am calling the above code in ActiveStep change event.
From next time onwards, I will make sure that the code will be in code block itself.
Thanks
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hello everyone,
Please I need help on the How to send E-mail from an ASPX page with VB.NET.
Thanks all.
Tunsten
|
|
|
|
|
Did you searched about it?
Read This[^]
|
|
|
|
|
Well, google has thousands of examples, so why not look there?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello everybody,
Is there any control like NumericUpDown(spinner) that is available in .Net framework specifically for web applications? I want it to use in web applications that is with asp.net. Thank you all.
|
|
|
|
|
|
Hey I thank you very much. I included the .dll file of (ajax control toolkit) in my visual studio and a can see for it and many other controls, but they are not active. How do I make them active? There is no refresh. Thank you.
|
|
|
|
|
It is an extender so you have add it to textbox..!by clicking smart tad on textbox add extender..!
|
|
|
|
|
HI,
I want to change the shape of the DIV using the CSS. I want the circular DIV rather than the general square DIV.
Please need help on this topic.
Thanks in advance.
Yogesh
|
|
|
|
|
|
hi
i am having 3 server (load balancing),however when i use this i am getting issue in session
i.e session in one server cannot access by other server..how to overcome this?
Please help me
Ramkumar
|
|
|
|
|
Which session mode are you using in Load Balancing enviroment ? Is it S/W LB or NLB ?
Please read this article, I have explained each and every thing on Session under LB enviroment.
Exploring Session in ASP.Net[^]
It may help you
|
|
|
|
|
when i upload my code i got this error
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type '_Default'.
Source Error:
Line 1: <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: f:\inetpub\suntvaus\Default.aspx Line: 1
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
any one pls explain this
|
|
|
|