473,511 Members | 13,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I do this?

ma
Hello,

I am new in ASP.NET. I read several books and know the concept but since
I am a C++ programmer I am lost in programming methodology in ASP.NET. Here
is my problem:

I have a page which consists of two sections. A tree view on left and a
detail view on right. The tree view would get its data from a database. For
simplicity I wrote a C# class to fill the tree with some dummy data. When
user click on any node, based on the node depth and also node content and
user name, the detail section should display some information. To do this I
created a master page. Since tree view would shows on all pages I put it on
master page. I fill the tree on master page load event.

When the user clicks on any node, I redirect the user to a new page based on
the depth of node.

Everything is working well till this point but the problem started from here
and they are:

1-Every time that user redirected to a new page, tree is populated. This
process is slow. The content of tree is not changed in any session but
master page load event is called for all child pages of this master page and
hence the tree is filled un necessarily.

2- Since the tree is populated when a new page is shown, it loses its state.

3- Since tree looses its state when user is redirected to a new page, I can
not detect what I need to show in the new page.

Now my questions:

1- Where is the best place to fill the tree view?

2- Is there any sample web program similar to what I want to create that I
can download and look at?

3- Is there any way that only detail section be rendered during a post back
and not the tree view itself? I read about AJAX and Atlas. Are they any
good? Can I use them with ASP.NET? Where can I read more about them and how
they are compared with each other?

4- Any other suggestion.

Regards


Aug 24 '07 #1
6 1638
ma wrote:
Hello,

I am new in ASP.NET. I read several books and know the concept but since
I am a C++ programmer I am lost in programming methodology in ASP.NET. Here
is my problem:

I have a page which consists of two sections. A tree view on left and a
detail view on right. The tree view would get its data from a database. For
simplicity I wrote a C# class to fill the tree with some dummy data. When
user click on any node, based on the node depth and also node content and
user name, the detail section should display some information. To do this I
created a master page. Since tree view would shows on all pages I put it on
master page. I fill the tree on master page load event.

When the user clicks on any node, I redirect the user to a new page based on
the depth of node.

Everything is working well till this point but the problem started from here
and they are:

1-Every time that user redirected to a new page, tree is populated. This
process is slow. The content of tree is not changed in any session but
master page load event is called for all child pages of this master page and
hence the tree is filled un necessarily.
Judging by this comment, I believe that it's safe to assume that the
contents of your pages are contained within a single rendered page. In
other words, you're not using frames of any kind. If that's so, did you
remember to put the binding of the DataSource of the tree inside of a
similar block?

if (!IsPostBack)
{
...
}
2- Since the tree is populated when a new page is shown, it loses its state.
Are you using the TreeView control or is this something custom you
rolled out? Either way, hopefully the above fixes it.
3- Since tree looses its state when user is redirected to a new page, I can
not detect what I need to show in the new page.
How are you doing this, anyhow? I would recommend that your links have
a query string value containing the ID of the content you wish to
display. For example http://www.mysite.com/mypage.aspx?ContentId=12345.

Hope that helps,

--
Sean
Aug 24 '07 #2
"ma" <ma@nowhere.comwrote in message
news:ec**************@TK2MSFTNGP03.phx.gbl...

Following on from Sean's comments, I wonder if you're confusing ASP.NET
MasterPages with HTML framesets - they are quite different...

With traditional HTML framesets, the user clicks a hyperlink in the 'menu'
frame and this causes a new page to be displayed in the 'main' frame.

However, MasterPages don't work like that at all. In fact, a MasterPage is
nothing more than a UserControl... MasterPages allow common look and feel
(and sometimes functionality) across several content pages - think of them
as templates. When a content page loads, it loads the MasterPage every time.
Therefore, if you have a TreeView in a MasterPage and click on one of its
nodes, it redirects to that file which in turn loads up the MasterPage...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 24 '07 #3
ma

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OL*************@TK2MSFTNGP05.phx.gbl...
"ma" <ma@nowhere.comwrote in message
news:ec**************@TK2MSFTNGP03.phx.gbl...

Following on from Sean's comments, I wonder if you're confusing ASP.NET
MasterPages with HTML framesets - they are quite different...

With traditional HTML framesets, the user clicks a hyperlink in the 'menu'
frame and this causes a new page to be displayed in the 'main' frame.

However, MasterPages don't work like that at all. In fact, a MasterPage is
nothing more than a UserControl... MasterPages allow common look and feel
(and sometimes functionality) across several content pages - think of them
as templates. When a content page loads, it loads the MasterPage every
time. Therefore, if you have a TreeView in a MasterPage and click on one
of its nodes, it redirects to that file which in turn loads up the
MasterPage...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Thanks Sean and Mark.

I have a table in my master page: header, footer, treeview and detail view.
should I use frameset here? If yes how? If now how do you design such
things?
I want when user click on a node in tree, only detail view is updated and
not the whole page. Is there any sample application that shows how this can
be implemented?

Regards
Aug 24 '07 #4
>should I use frameset here

Not if you can help it. Frames have a time and a place but generally
they are regarded as an outdated method and they can cause more
problems than necessary.
>I want when user click on a node in tree, only detail view is updated and not the whole page.
This is a scenario where an AJAX method may be useful as it allows you
to update certain parts of the page. If you haven't already seen it,
visit http://ajax.asp.net to see some samples and decide whether this
would be useful in your application.

--
Mark Smith
http://aspnetlibrary.com

Aug 24 '07 #5
ma

"ca****@aspnetlibrary.com" <ma**************@gmail.comwrote in message
news:11**********************@x40g2000prg.googlegr oups.com...
>>should I use frameset here

Not if you can help it. Frames have a time and a place but generally
they are regarded as an outdated method and they can cause more
problems than necessary.
>>I want when user click on a node in tree, only detail view is updated
and not the whole page.

This is a scenario where an AJAX method may be useful as it allows you
to update certain parts of the page. If you haven't already seen it,
visit http://ajax.asp.net to see some samples and decide whether this
would be useful in your application.

--
Mark Smith
http://aspnetlibrary.com
Thanks mark,I am going to study AJAX. Is there any other way to do this?
If you open MSDN on web, you can see something similar to what I want to
develop ( the difference is that right section in MSDN is a static HTML but
in my case it is a dynamic one). How that ASP.NET is working? Are they using
AJAX? how they manage to update only the right side of screen without
refreshing the whole screen?

Regards

Aug 24 '07 #6
they use a combination of ajax and iframes. note with an iframe you need
to write javascript to handle resizes, and content can not be displayed
outside the frame boundary, so they don't work for flyout menus.

-- bruce (sqlwork.com)

ma wrote:
"ca****@aspnetlibrary.com" <ma**************@gmail.comwrote in message
news:11**********************@x40g2000prg.googlegr oups.com...
>>>should I use frameset here
Not if you can help it. Frames have a time and a place but generally
they are regarded as an outdated method and they can cause more
problems than necessary.
>>>I want when user click on a node in tree, only detail view is updated
and not the whole page.
This is a scenario where an AJAX method may be useful as it allows you
to update certain parts of the page. If you haven't already seen it,
visit http://ajax.asp.net to see some samples and decide whether this
would be useful in your application.

--
Mark Smith
http://aspnetlibrary.com

Thanks mark,I am going to study AJAX. Is there any other way to do this?
If you open MSDN on web, you can see something similar to what I want to
develop ( the difference is that right section in MSDN is a static HTML but
in my case it is a dynamic one). How that ASP.NET is working? Are they using
AJAX? how they manage to update only the right side of screen without
refreshing the whole screen?

Regards
Aug 24 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3328
by: James | last post by:
I have a from with 2 fields: Company & Name Depening which is completed, one of the following queries will be run: if($Company){ $query = "Select C* From tblsample Where ID = $Company...
5
2738
by: Scott D | last post by:
I am trying to check and see if a field is posted or not, if not posted then assign $location which is a session variable to $location_other. If it is posted then just assign it to...
2
2711
by: Nick | last post by:
Can someone please tell me how to access elements from a multiple selection list? From what ive read on other posts, this is correct. I keep getting an "Undefined variable" error though... Form...
2
2528
by: Alexander Ross | last post by:
I have a variable ($x) that can have 50 different (string) values. I want to check for 7 of those values and do something based on it ... as I see it I have 2 options: 1) if (($x=="one") ||...
0
3258
by: Dan Foley | last post by:
This script runs fine, but I'd like to know why it's so slow.. Thanks for any help out there on how i can make it faster (it might take up to 5 min to write these 3 export files whith 15 records...
5
3193
by: Lee Redeem | last post by:
Hi there I've created abd uploaded this basic PHP script: <html> <head> <title>PHP Test</title> </head> <body> <H1 align="center">
5
10035
by: christopher vogt | last post by:
Hi, i'm wondering if there is something like $this-> to call a method inside another method of the same class without using the classname in front. I actually use class TEST { function...
6
2653
by: Phil Powell | last post by:
Ok guys, here we go again! SELECT s.nnet_produkt_storrelse_navn FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v, nnet_storrelse_varegruppe_assoc sv, nnet_produkt p WHERE...
1
2182
by: Michel | last post by:
a site like this http://www.dvdzone2.com/dvd Can you make it in PHP and MySQL within 6 weeks? If so, send me your price 2 a r a (at) p a n d o r a . b e
11
3135
by: Maciej Nadolski | last post by:
Hi! I can`t understand what php wants from me:( So: Cannot send session cache limiter - headers already sent (output started at /home/krecik/public_html/silnik.php:208) in...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.