Is it possible to access another Page in code-behind

D

Dan

We have a simple site. It's a frameset with two frames a left and a right.
The left frame is essentially a list of records from a database (using a
server-side repeater control). When you click on one of the items in the
left frame, it targets the right frame and displays a form prefilled with
information for the item you clicked.

The problem is the left frame's list just shows the names of the items, and
the name of the item is editable in the right frame. So if I change the
name of the item in the right frame and save, I need it to automatically
update item's name in the left frame. How can I accomplish this?

Is there is a way to accomplish this through server side code?

Right now we're doing a clunky javascript solution which works, but I'm
hoping there is a better way. Basically in the save event for the right
frame (in the code-behind page), after the item is saved, we redirect to a
page that says "Your information has been saved" (or something to that
effect). On this page's body's onload event (in the <body> tag, i.e.
client-side) we are targetting the left frame to refresh with javascript.
It works, but like I said it seems clunky.

Is there anyway in the save event for the right frame (in the code-behind
page), to tell the left frame to refresh.

Thanks in advance,
Dan
 
J

Jason S

Dan,

I'm not sure why this seams clunky... that is the way I woud do it. No, you
cannot control a user's window refresh from the server - although you could
resend the entire frameset. Same result.

Regards,
Jason S.
 
D

Dan

Thanks for the response.

The real reason for wanting a better solution is because our application is
actually a lot more complicated than I posted originally but the same
principle applies. In our project, the list in the left frame is actually a
treeview, and the goal is to update the treenode's text with the appropriate
changes, while at the same time keeping the treeview's state by remembering
what nodes are expanded.

It's basically like the windows explorer and how it deals with files and
folders.

If I simply refresh the left frame, the entire treeview must be reloaded
from scratch and no state is able to be kept (the user is forced to drill
down to get to where they were before).

I was hoping there was a way to simple reference the left frame's treeview
and change it from the code-behind page of the right frame. There are other
options that I've considered which require much more work, but I thought I'd
see if there was an easier way before I started coding with those.

Thanks,
Dan
 
J

Jason S

Ah, see, you didn't represent the entire problem. If I were you I would
save the path in the viewstate so that if I had to refresh it I could come
back to that area for the user. A la MSDN library
(msdn.microsoft.com/library).

As far as accessing the page across the frame from another page on the
server I really don't see that. It's an interesting question from the
perspective of the container page though. I don't know if you could make
the framesets runat=server or not but that may be a way.

Regards,
Jason
 
D

Dan

Thanks for the help.

I ended up having the right frame post, save, set a couple session
variables, and redirect to a page whose onload event submits the left frame.
The left frame then recursively loops through the treenodes until it finds
the one that has been edited (comparing its id with that of 1 of the session
variables), and changes its text to the new text (from the other session
variable). This way the tree keeps its state (remembering which branches
were expanded) and the text of the node changes appropriately. Still wish
there was a better way though.

Thanks,
Dan
 
J

Jason S

Hmm, too bad you can't just save the id of the last leaf that was opened and
then call something like tree.navigateto(leafID) and let the control sort it
out.

Jason S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top