call another page on the left side.

hi

here is my scenario:
i have a page1 where i just ve a column with some 50 rows in it. this list in a datagrid with all with hyperlink. i want that when i click to the hyperlink, then on the right side of hte page i will get all the information displayed in some textboxes or other controls.this right side i will design a fresh page named page2.

i wanted to insert a frame on the page2 and then insert/call page1 inside that frame.is it possible in first place?

pls can someone tell me how to do it

thanks a lot for replying.

LVL 1
samir25Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Hi samir25,

The first part of your question makes sense and I can think of a number of ways to achieve this (with or without frames), I am having trouble understanding the second half though, why would you need a frame in the second page (right hand side) that calls the first page (left hand side)?

Tim Cottee
samir25Author Commented:
i need a frame on the left hand side of the main page.
i need a frame for 2 reasons.
1. my left side list has 50 rows so it will then appear like a scrollbar so that i can scroll down. i actually dont want to change my design.
2. i am converting from asp to asp.net.  i want to retain the design as i am running short of time.

pls guide me if u ve any idea how to do it.
i tried to insert frame using the frame menu on the aspx page. all the items underneath are greyed out for some reason.

pls sugg
TimCotteeHead of Software ServicesCommented:
samir25,

The frames menu is only active when you have a page that already has frames in it. You can create a frameset.htm page in visual studio by adding a new item to the project and choosing the frameset type.

If you want your frameset page to be an aspx then you should simply create the aspx and the frameset page and copy one into the other so you end up with something like:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="testing.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <TITLE>Contents Frameset</TITLE>
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <frameset cols="150,*" border="0" frameSpacing="0" frameBorder="0">
        <frame name="contents" src="">
        <frame name="main" src="">
        <noframes>
            <pre id="p2">
================================================================
INSTRUCTIONS FOR COMPLETING THIS CONTENTS FRAMESET
1. Add the URL of your src="" page for the "contents" frame.
2. Add the URL of your src="" page for the "main" frame.
3. Add a BASE target="main" element to the HEAD of your
    "contents" page, to set "main" as the default frame  
    where its links will display other pages.
================================================================
</pre>
            <p id="p1">
                This HTML frameset displays multiple Web pages. To view this frameset, use a
                Web browser that supports HTML 4.0 and later.
            </p>
        </noframes>
    </frameset>
</HTML>

In your aspx page. This then means you can set the src for each frame to your pages as you would normally do and that the frames menu will be activated for you to manipulate your frames.

Tim
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

samir25Author Commented:
ok let me try this
samir25Author Commented:
Tim

i cud create a frame from vs.net after and i included both the pages also . it works well also.but many things are confusing me.

i will go one by one.
1. this page is visible is frameset1.htm.so will it remain an htm or what?so when i login and i open this page as not an aspx page but i refer to it as frameset1.htm???

2. how do i link both the pages??? i mean when i login i want the right side to be blank . its only when i click on the left side on any of the links then i want data to appear on the right.

lot of confusing points. hope i make myself clear.

thanks a lot Tim for helping.
TimCotteeHead of Software ServicesCommented:
samir25,

It is frameset1.htm. However as I show above, you can copy/paste the elements from that into an empty aspx page which will then become a frameset page. Don't forget that aspx pages are simply a combination of html code and server-side code (either in page or referenced as code-behind). So anything that can be done in an HTML page can also be done in a page with an aspx extension.

To link the pages, set the initial src property of the right frame to about:blank this will leave it empty until such time as you put something in it. To do that, you need to add a target property to the hyperlinks in the left frame. in html this would be <a href="mydetails.aspx?something=somethingelse&id=100" target="main">click here for details on id100</a> the value for the target attribute is the name of the frame in which that url should be opened.

Tim
samir25Author Commented:
jsut seeing ur feedback..let me see then
thanks again
samir25Author Commented:
hi Tim,,

i accidently deleted the codebehind code of one of the pages which i am calling in the frame. because of which i am unable to run it.

i tried to double click and see the code behind by many ways ...but somehow i cannot get the code back.what happened can u help resolve this?

thanls agian
TimCotteeHead of Software ServicesCommented:
samir25,

That is going to be tricky, unless you can go back to visual studio and try to "undo" the changes you made, your code behind has gone. It is not stored in the aspx at all so you will need to rewrite it if you don't have a backup copy or cannot undo to get back to where you were.

Tim
samir25Author Commented:
yes i recreated a new page finally.
i cud do the first part.
now goign to try the second part.
samir25Author Commented:
hi tim,
ur 2nd part is not clear to me.
my left frame is a datagrid where i am using hyperlinks attribute:
<asp:datagrid id="dgVersion" runat="server" ShowFooter="True" AutoGenerateColumns="False">
                  <Columns>
                        <asp:TemplateColumn HeaderText="Server List" HeaderStyle-Font-Bold="True">
                              <ItemTemplate>
                                    <asp:HyperLink id="AttachmentLink" runat="server" NavigateUrl="#">
                                          <%#DataBinder.Eval(Container.DataItem,"ServerName")%>
                                    </asp:HyperLink>
                              </ItemTemplate>
                        </asp:TemplateColumn>
                  </Columns>
            </asp:datagrid>

so how can i use a href over there?i think i am missing something here.can u pls elaborate more clearly so that i can understad?
thanks a lot
TimCotteeHead of Software ServicesCommented:
samir25,

Add target="main" into the hyperlink:

                              <asp:HyperLink id="AttachmentLink" target="main" runat="server" NavigateUrl="#">
                                   <%#DataBinder.Eval(Container.DataItem,"ServerName")%>
                              </asp:HyperLink>

This tells the link to open itself in the target frame, as you may know there are various options for the target attribute: _blank (new window), _self (same window), _top (initial frame), xxxx (named frame or window) so setting this to "main" means that the url referenced by the hyperlink will open in the frame specified which should be the right-hand frame of your frameset.

Tim

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
samir25Author Commented:
ok i got what u explained.

but now how do i pass a value.say on the left side i have a simple queried data from db(select name from employee). so now i want to open al detials of employees when i clcik on the link.

how can i retrieve and pass the id?so that based on that id i get all the data in the textboxes on the right frame.

i think i will close this thread as hte main ques has been resolved.

pls do respond to the other thread i am posting.
thanks a lot again
TimCotteeHead of Software ServicesCommented:
samir25,

Your navigateurl attribute needs to be something like:

MySecondPage.aspx?ID=100

Then in your second page code you can retrieve the ID using Request.Querystring("ID") and determine what to display based on that value.

Tim
samir25Author Commented:
Tim can i give it as :
MySecondpage.aspx?ID=pk_key

ia m retrieving query as :
select pk_key, name from employees
pls suggest
TimCotteeHead of Software ServicesCommented:
samir25,

Yes indeed, that is the idea. So your link will endup in the format described (pk_key text will be replaced by the corresponding value of course). Then the second page can use that pk_key value to requery the employee table to display their details.

Tim
samir25Author Commented:
i think i am doing something wrong.bec its not working!

do i need to write as ==>
NavigateUrl="ServerMain2.aspx?Id=pk_key"

bec pk_key is somehting i am retrieving from db
select pk_key, name from employees

how do i refer this.?
TimCotteeHead of Software ServicesCommented:
samir25,

Try this:

      <asp:HyperLink id="AttachmentLink" runat="server" DataNavigateUrlField="pk_key" DataNavigateUrlFormatString="MySecondPage.aspx?ID={0}">
           <%#DataBinder.Eval(Container.DataItem,"ServerName")%>
      </asp:HyperLink>

The {0} bit means "replace me with the value from the field specified in DataNavigateURLField" so each link will get the pk_key value from the bound dataset added to it.

Tim
samir25Author Commented:
u have remove target = main??
also when i type DataNavigateUrlField="pk_key" it give red line..saying this attribute is not found with hyperlink

samir25Author Commented:
hi Tim also can u pls respond to this thread so that i dont need t odelete it.

thnks
TimCotteeHead of Software ServicesCommented:
samir25,

Losing target="main" was my mistake, it should be there of course. As for the red line part, I don't necessarily have an answer, having tested it myself it works fine. The attribute is apparently supported in versions 1.0, 1.1 and 2.0 of the .net framework so unless you have some peculiar version that shouldn't be your problem.

Tim
samir25Author Commented:
no my version is vs.2002 ..then let me try to run it too ignoring hte error
samir25Author Commented:
hi Tim
in the 2nd apge where exactly can i refer to the request.querystring.

do i need to refer it on the codenehind or in inline code.

pls suggest
thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.