|
The same way I'd write a Binary tree for any other type of ASP.NET application; only the data would change.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
MLM Companies present their CUSTOMER HIERARCHY with a Horizontal Tree like Binary Tree ( 2 legs ), Sponsor Tree ( multiple Legs ), POOL Tree ( 3 or 4 legs)
Normal Tree Controls are vertical But you can build it Using COMPOSITE Control and Define your Legs / Levels at design time on your page.
Below is a Code Snippet to make you some idea about it.
<br />
namespace MLMTreeCntrol<br />
{<br />
<br />
<br />
public class templatedTree : System.Web.UI.WebControls.CompositeControl, INamingContainer<br />
{<br />
private ITemplate messageTemplate = null;<br />
private ITemplate TreeNode = null;<br />
private int _MaxLevel = 1;<br />
private int _Branch = 2;<br />
<br />
public int StartLevel<br />
{<br />
get<br />
{<br />
return (int)ViewState["_StartLevel"];<br />
}<br />
set<br />
{<br />
ViewState["_StartLevel"] = value;<br />
<br />
}<br />
}<br />
<br />
public int MaxLevel<br />
{<br />
get<br />
{<br />
return _MaxLevel;<br />
}<br />
set<br />
{<br />
_MaxLevel = value;<br />
}<br />
}<br />
<br />
public int Branch<br />
{<br />
get<br />
{<br />
return _Branch;<br />
}<br />
set<br />
{<br />
_Branch = value;<br />
}<br />
}<br />
<br />
[TemplateContainer(typeof(MessageContainer))]<br />
[PersistenceMode(PersistenceMode.InnerProperty)]<br />
public ITemplate MessageTemplate<br />
{<br />
get<br />
{<br />
return messageTemplate;<br />
}<br />
set<br />
{<br />
messageTemplate = value;<br />
}<br />
}<br />
<br />
<br />
[TemplateContainer(typeof(MessageContainer))]<br />
[PersistenceMode(PersistenceMode.InnerProperty)]<br />
public ITemplate Node<br />
{<br />
get<br />
{<br />
return TreeNode;<br />
}<br />
set<br />
{<br />
TreeNode = value;<br />
}<br />
}<br />
<br />
public delegate void NodeHandler(object sender, CommandEventArgs e, MessageContainer s);<br />
public event NodeHandler ItemCommandA;<br />
<br />
protected override bool OnBubbleEvent(object sender, EventArgs e)<br />
{<br />
ItemCommandA(this, (CommandEventArgs)e, ((Control)sender).NamingContainer as MessageContainer);<br />
CommandEventArgs C = (CommandEventArgs)e;<br />
return true;<br />
}<br />
<br />
<br />
protected override void CreateChildControls()<br />
{<br />
if (ViewState["_StartLevel"] == null)<br />
{<br />
ViewState["_StartLevel"] = 1;<br />
}<br />
this.Controls.Clear();<br />
if (messageTemplate != null)<br />
{<br />
makeTree((int)ViewState["_StartLevel"], this, 1);<br />
}<br />
}<br />
<br />
public override void DataBind()<br />
{<br />
CreateChildControls();<br />
<br />
this.ChildControlsCreated = true;<br />
<br />
base.DataBind();
}<br />
<br />
<br />
<br />
private void makeTree(int i, Control ctrl, int level)<br />
{<br />
if (level <= MaxLevel)<br />
{<br />
ctrl.Controls.Add(new LiteralControl("<table border=1><tr><td colspan=" + _Branch + " align=center>"));<br />
MessageContainer container = new MessageContainer(i, "r");<br />
messageTemplate.InstantiateIn(container);<br />
ctrl.Controls.Add(container);<br />
<br />
ctrl.Controls.Add(new LiteralControl("</td></tr><tr>"));<br />
<br />
for (int j = 1; j <= _Branch; j++)<br />
{<br />
ctrl.Controls.Add(new LiteralControl("<td align=center>" + i));<br />
makeTree(i + j, ctrl, level + 1);<br />
ctrl.Controls.Add(new LiteralControl("</td>"));<br />
}<br />
<br />
<br />
ctrl.Controls.Add(new LiteralControl("</tr></table>"));<br />
}<br />
}<br />
<br />
<br />
public class MessageContainer: Control, INamingContainer<br />
{<br />
private int m_index;<br />
private Object node;<br />
<br />
private String m_message;<br />
internal MessageContainer(int index, Object Cnode)<br />
{<br />
m_index = index;<br />
node = Cnode;<br />
<br />
}<br />
public int Index<br />
{<br />
get<br />
{<br />
return m_index;<br />
}<br />
}<br />
<br />
public Object NodeVal<br />
{<br />
get<br />
{<br />
return node;<br />
}<br />
}<br />
}<br />
}<br />
}<br />
<br />
hope this helps
cheers
Believes in betterment not the Best
|
|
|
|
|
We have a 3.5 application and are planning on supporting 4.0 in the near future and were wondering if we should just tell our support to only install the 4.0 framework now. The question really is, will a 3.5 application work, with no changes with only the 4.0 framework installed?
Randar Puust
Software Architect, Jonas Software
MCSD.Net, MCSE
|
|
|
|
|
Yes, definitely.
Dotnet Framework 4.0 provides backward compatibility.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
really? that is not how I understand it. Unfortunately I can't test it easily right now.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Jinal Desai - LIVE wrote: Dotnet Framework 4.0 provides backward compatibility.
In that case it should include 3.5, either within itself or by auto install.
It's time for a new signature.
|
|
|
|
|
Just change the target framework in your application (3.5 Framework one) and test it once. If everything goes fine then you can go ahead with only 4.0 on the computer.
|
|
|
|
|
If you are creating an installer with the .NET Framework specifications/requirements, it will compel the user to install the version you have specified even if the user has a newer version.
|
|
|
|
|
I've tested this and it seems that any solution/project created under 3.5 and opened in 4.0 requires conversion - it automatically brings up a conversion wizard. Creating new projects under 4.0 gives the choice of frameworks 2.0, 3.0, 3.5 or 4.
|
|
|
|
|
yes, the project files for different Studio versions have different content; this is independent of the .NET version that is being targeted by the project. So VS2010 can create a project that targets .NET 2.0, and said project will result in an exe/dll that runs fine on a 2.0-only system, but the project itself won't open in VS2005.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I have Visual Studio 2003 and 2005 installed in my system. I need to work on old project which is in 2003, but I am unable to open the project in Visual Studio. While trying to open I'm getting the following error message:
<br />
"Visual Studio.Net cannot create or open the application. The likeliest problem is that required components are not installed on the local Web server. Run Visual Studio .Net setup and add the Web Development component"<br />
I have done the following for resolution, but same scenario is repeating.
1. I have created the virtual directory and configured it properly.
2.Open VS.NET 2003 command prompt and run aspnet_regiis.exe -i for registering which in .Net Framework version folder
3. I tried to delete the project and add it again.
I have installed .net 2005 first and then 2003. Is this may be the cause for the error? If so, should I uninstall all of .net 2.0 version and then check? Or should I need to change something in solution file?
Please advice what to do. Please help.
Thanks
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
All relevant facts are gathered in this little article[^]. The most important one is: Visual Studio 2003 is the only version that can target .NET 1.1; and of course it needs 1.1 to be installed.
You can probably open the 1.1 solution or project with Visual Studio 2005, but then:
1. that one can't create a 1.1 executable (it only targets 2.0, and requires 2.0);
2. it will convert your project files, so they will no longer open in VS2003.
Conclusion: If you need to target 1.1, use VS2003 and your original set of project files.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thank you for the reply and related article.
I am opening .Net 1.1 only, not in Visual Studio 2005. While trying to open .Net 1.1 projects, I right-click and select Visual Studio 2003. I am getting this error while trying to open the solution file of 1.1 version in the IDE of Visual Studio 2003.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
I can't help you then; I don't remember ever having seen such error, and I stopped using 1.1 and VS2003 long ago.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I think old style web site projects used FrontPage extensions to do some stuff. If you don't have that running on your server it may not be able to find the site.
|
|
|
|
|
How the memory is allocated in heap for a dynamically growing List.
while creating a new object the number of bytes required for that type is allocated in heap. How this is working if that class has a dynamic list???
My small attempt...
|
|
|
|
|
|
a List does not store its items, all it stores are references to those items. Basically it stores them in an array. When the array gets full, a new array is allocated, twice the size, and its content (the references!) is copied to the new array.
Objects never grow. They have a fixed size in memory. Assuming Car and Wheel are classes, when a Car object has four Wheel objects, it holds 4 references to those Wheel instances, which are separate objects. If Wheel where a struct (hence a value type, not a reference type), the Car would hold memory to store 4 Wheel instances all the time, whether you initialize them or not.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
It is like a linked list(not really.. but for the memory allocation part). It can have any number of items while memory is free. It is like using malloc function
|
|
|
|
|
pranav95 wrote: It is like a linked list
Not at all. A linked list would consist of individual items, each holding one or two pointers to its logical neighbors, and would imply: a separate memory block for each item, no overall memory requirement (except maybe for a head node and a tail node), and certainly no memory requirement larger than the item size itself. A .NET collection is based on an array, most additions do not require any memory requirement at all, and the array's capacity grows by doubling it, which may cause it to become located in the "large object heap" and may even cause fragmentation and out-of-memory situations one would not have with a linked list; OTOH being array-based has advantages, e.g. it allows for an O(1) indexing.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
according to my current knowledge in .net memory management the value types are stored in stack and reference types are stored in managed heap.
Form this, its clear that the object of a class will be saved in heap. Then where will be the memory allocated for the value type member of that class??
My small attempt...
|
|
|
|
|
The entire object will be stored on the heap including any 'value type' members.
It's time for a new signature.
|
|
|
|
|
For a method's local variables, value types are indeed stored on the stack and reference types on the heap. Reference types are a little confusing, however, because they are really stored in two parts: the reference, which is stored on the stack just like a value type, and the 'body', which is stored on the heap.
Now, lets look at the body of a type (reference type or value type). Reference types and value types can have fields of both types. The fields of a type are (effectively) concatenated together. So the body of a type is the concatenation of the contained value types and the references to the contained reference types. And this body is 'a chunk of memory' which is stored somewhere - on the stack (if its the body of a value type), on the heap (if its the body of a reference type) .. or nestled inside the body of some other type (if its a field in another type).
So, it may be more useful to think of value types as being stored 'where they are declared' instead of thinking of them as being stored on the stack, while reference types have their reference stored where the variable is declared, and its body is always stored on the heap.
|
|
|
|
|
Hi
As i was preparing to deliver my first software (VB.NET 2.0/Access 2003) I noticed the folder containing the database is published separately from the set up file. i browsed it and realised all i needed to do was remove the .deploy extension added by vb to the database file and, voila, i had the access database visible and opening like it was not even part of the software.
My assumption was that it should be locked inside the software set-up, which is not. Does anyone know how to hide the database so that users cannot just find it and open it? How come i have never see the database that runs Ms Word, for example?
|
|
|
|
|
cyberexel wrote: As i was preparing to deliver my first software (VB.NET 2.0/Access 2003
Which version of VB.NET?? I'm assuming you're talking about .NET 2.0.
cyberexel wrote: My assumption was that it should be locked inside the software set-up
Wrong. Access is a file-based desktop database.
cyberexel wrote: Does anyone know how to hide the database so that users cannot just find it and open it?
Impossible. Since it's always a file, and users have the ability to show hidden files, you can't really hide it at all. The best you can do is password protect it, but then there's always the utilities sprinkled throughout the web that will break that.
cyberexel wrote: How come i have never see the database that runs Ms Word, for example
Because there's no database that runs Word?
|
|
|
|