Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. working with frames

working with frames

Scheduled Pinned Locked Moved ASP.NET
questiondata-structures
10 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neha12
    wrote on last edited by
    #1

    I am using 2 frames in my application , 1st> Left_Frame 2nd> Right_Frame Now in the left frame I have a treestructure maintained. So at the click event of any node of that tree structure I want my rightframe to be updated accordingly. So my question is how can I control the right frame from the left frame? Neha

    H 1 Reply Last reply
    0
    • N neha12

      I am using 2 frames in my application , 1st> Left_Frame 2nd> Right_Frame Now in the left frame I have a treestructure maintained. So at the click event of any node of that tree structure I want my rightframe to be updated accordingly. So my question is how can I control the right frame from the left frame? Neha

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Give each <frame> a name attribute and in your <a> links use the target="_name_" property to target the named frame. You can also use pre-defined names like _blank, _parent, _search, _self, and _top. _self is the default and has the same behavior as if you didn't include a target attribute at all.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      N 1 Reply Last reply
      0
      • H Heath Stewart

        Give each <frame> a name attribute and in your <a> links use the target="_name_" property to target the named frame. You can also use pre-defined names like _blank, _parent, _search, _self, and _top. _self is the default and has the same behavior as if you didn't include a target attribute at all.

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        N Offline
        N Offline
        neha12
        wrote on last edited by
        #3

        Thanks , but its not solving my problem. Iam doing this in ASP.net & in the "treeview1's selected index changed" click event I want to extract the database values & put them onto the right frame.... I feel now its more clear... Now could u guide me?

        H 1 Reply Last reply
        0
        • N neha12

          Thanks , but its not solving my problem. Iam doing this in ASP.net & in the "treeview1's selected index changed" click event I want to extract the database values & put them onto the right frame.... I feel now its more clear... Now could u guide me?

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          It doesn't matter if you're doing this in ASP.NET, PHP, JSP, or static HTML files - the way to target a link in another frame or window is to use the target. See http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/target.asp[^] for more information. If you only one to have one page that contains a DataGrid or something for each tree node in the left pane, then make each link target the same filename but pass a query string. For instance, if each tree node has a unique ID that is resolvable in the database, you could make each link like so:

          <a href="/dir/page.aspx?id=nodeID" target="leftFrame">text</a>

          It does work and is done on countless web sites. It all a matter of designing the interaction between your frames.

          -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

          N 1 Reply Last reply
          0
          • H Heath Stewart

            It doesn't matter if you're doing this in ASP.NET, PHP, JSP, or static HTML files - the way to target a link in another frame or window is to use the target. See http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/target.asp[^] for more information. If you only one to have one page that contains a DataGrid or something for each tree node in the left pane, then make each link target the same filename but pass a query string. For instance, if each tree node has a unique ID that is resolvable in the database, you could make each link like so:

            <a href="/dir/page.aspx?id=nodeID" target="leftFrame">text</a>

            It does work and is done on countless web sites. It all a matter of designing the interaction between your frames.

            -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

            N Offline
            N Offline
            neha12
            wrote on last edited by
            #5

            Thanx , I got ur point. But now one more problem has come up. I have build the tree structure in the left frame. But Iam not able to catch the click event of a specific node. Like when I execute the application and click at the node then nothing is happening. Iam doing this to catch the clicked node... Private Sub TreeView1_SelectedIndexChange(ByVal sender As Object, ByVal e As Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs) Handles TreeView1.SelectedIndexChange Dim node8 As New TreeNode() node8 = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex) What is wrong in this ?? Waiting for the reply ??

            H 1 Reply Last reply
            0
            • N neha12

              Thanx , I got ur point. But now one more problem has come up. I have build the tree structure in the left frame. But Iam not able to catch the click event of a specific node. Like when I execute the application and click at the node then nothing is happening. Iam doing this to catch the clicked node... Private Sub TreeView1_SelectedIndexChange(ByVal sender As Object, ByVal e As Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs) Handles TreeView1.SelectedIndexChange Dim node8 As New TreeNode() node8 = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex) What is wrong in this ?? Waiting for the reply ??

              H Offline
              H Offline
              Heath Stewart
              wrote on last edited by
              #6

              neha12 wrote: Dim node8 As New TreeNode() node8 = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex) First of all, don't create a new instance of the TreeNode with New because the variable will just end up referencing the node from the second line. You're instantiating a TreeNode for nothing. Second, why are yo handling events on the server-side? If you've built your tree and allow for client-side expansion, each hyperlink only needs to use the target attribute to target the other frame. The link would send a query param to the other page, which gets executed on the server and downloaded to the client (like everything else you view online). Handling the events on the server side means that you have to synchronize your frames on the server and this is really not an easy thing to do. Remember that the server only deals with page execution and knows nothing about how the pages are laid on in frames. Your right frame will get executed when the user clicks a link in your left frame (the tree) and the server will parse the execute the request, then will send the page to the browser. For an example, go to http://msdn.microsoft.com/library[^] and see how their tree and topic pages work. The tree almost never reloads (only in some cases since it chunked into certain on-demand trees) but the right page content always changes. In your case, however, you send the page request to the right frame using the same filename but with a different query string, like so:

              RootNode : href="/topic.aspx?id=1" target="rightFrame"
              +-FirstNode : href="/topic.aspx?id=2" target="rightFrame"
              | +-FirstNode1 : href="/topic.aspx?id=3" target="rightFrame"
              | +-FirstNode2 : href="/topic.aspx?id=4" target="rightFrame"
              +-SecondNode : href="/topic.aspx?id=5" target="rightFrame"

              In the Page_Load handler for your topic.aspx page (just making up names here, change them to suit your needs of course) you get the ID using Request.Params["id"] and do your database querying or whatever using that ID to fill a DataGrid or whatever you need to do.

              -----BEGIN GEEK CODE BLOCK-----

              N 1 Reply Last reply
              0
              • H Heath Stewart

                neha12 wrote: Dim node8 As New TreeNode() node8 = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex) First of all, don't create a new instance of the TreeNode with New because the variable will just end up referencing the node from the second line. You're instantiating a TreeNode for nothing. Second, why are yo handling events on the server-side? If you've built your tree and allow for client-side expansion, each hyperlink only needs to use the target attribute to target the other frame. The link would send a query param to the other page, which gets executed on the server and downloaded to the client (like everything else you view online). Handling the events on the server side means that you have to synchronize your frames on the server and this is really not an easy thing to do. Remember that the server only deals with page execution and knows nothing about how the pages are laid on in frames. Your right frame will get executed when the user clicks a link in your left frame (the tree) and the server will parse the execute the request, then will send the page to the browser. For an example, go to http://msdn.microsoft.com/library[^] and see how their tree and topic pages work. The tree almost never reloads (only in some cases since it chunked into certain on-demand trees) but the right page content always changes. In your case, however, you send the page request to the right frame using the same filename but with a different query string, like so:

                RootNode : href="/topic.aspx?id=1" target="rightFrame"
                +-FirstNode : href="/topic.aspx?id=2" target="rightFrame"
                | +-FirstNode1 : href="/topic.aspx?id=3" target="rightFrame"
                | +-FirstNode2 : href="/topic.aspx?id=4" target="rightFrame"
                +-SecondNode : href="/topic.aspx?id=5" target="rightFrame"

                In the Page_Load handler for your topic.aspx page (just making up names here, change them to suit your needs of course) you get the ID using Request.Params["id"] and do your database querying or whatever using that ID to fill a DataGrid or whatever you need to do.

                -----BEGIN GEEK CODE BLOCK-----

                N Offline
                N Offline
                neha12
                wrote on last edited by
                #7

                Hello , I got ur point but still Iam not able to successfully execute the application. Iam doing the coding in ASP.net code view. And while adding the nodes from the database to the left frame Iam not allowed togive this statement. FirstNode : href="/topic.aspx?id=2" target="rightFrame" waiting for the reply,

                H 1 Reply Last reply
                0
                • N neha12

                  Hello , I got ur point but still Iam not able to successfully execute the application. Iam doing the coding in ASP.net code view. And while adding the nodes from the database to the left frame Iam not allowed togive this statement. FirstNode : href="/topic.aspx?id=2" target="rightFrame" waiting for the reply,

                  H Offline
                  H Offline
                  Heath Stewart
                  wrote on last edited by
                  #8

                  Of course you can't give those "commands" because 1) they're not even commands, and 2) they're representational of what your resulting HTML output should look like. You need to construct your tree from whatever source you want, but each node should have a target="rightFrame" (where "rightFrame" is the name you gave to the right frame). There are many ways of doing this. You can even just hard-code this in our HTML output statement.

                  -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                  N 1 Reply Last reply
                  0
                  • H Heath Stewart

                    Of course you can't give those "commands" because 1) they're not even commands, and 2) they're representational of what your resulting HTML output should look like. You need to construct your tree from whatever source you want, but each node should have a target="rightFrame" (where "rightFrame" is the name you gave to the right frame). There are many ways of doing this. You can even just hard-code this in our HTML output statement.

                    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                    N Offline
                    N Offline
                    neha12
                    wrote on last edited by
                    #9

                    I have done the same thing. I gave the target for each node as the name of the right frame. u know I have again come back to the point where I started. Whats this?? If u want to guide then kindly give some solid solution otherwise it will make me confuse since I have just started with this ASP.net programming.

                    H 1 Reply Last reply
                    0
                    • N neha12

                      I have done the same thing. I gave the target for each node as the name of the right frame. u know I have again come back to the point where I started. Whats this?? If u want to guide then kindly give some solid solution otherwise it will make me confuse since I have just started with this ASP.net programming.

                      H Offline
                      H Offline
                      Heath Stewart
                      wrote on last edited by
                      #10

                      Clicking a link in the left frame - the tree - is completely a client-side event. With the target set to the right frame and a link like /somepage.aspx?id=someid, it will cause the browser to request /somepage.aspx from the server, passing the id=someid as a query string. In that page's code - perhaps in the Page_Load handler - you would do something like this:

                      private void Page_Load(object sender, EventArgs e)
                      {
                      // No error-checking below - you should add some.
                      int id = Int32.Parse(Request.Params["id"]);
                      // Use this ID to select something from you database or a file or something
                      // and output to the page or bind them to controls.
                      }

                      This is very standard CGI-like handling where you request a page with a query string or post form data (corresponds to GET and POST form actions respectively) and that page uses the query string or form parameters to get information and display it.

                      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups