Solved

reloading a frame within a listbox SelectedIndexChanged event?

Posted on 2004-09-20
10
581 Views
Last Modified: 2006-11-17
Hi There,

I was wondering how I can reload a frame within a listtbox SelectedIndexChanged event? I have tried the code below and it does not seem to work at all, could someone helkp me out with the syntax please?

Sean - thanks in advance


Public Sub lstStates_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstStates.SelectedIndexChanged

        Label1.Text = lstStates.SelectedItem.Value
        Response.Write("<Script language='javascript'>window.parent.document.frames(1).location.href='sidemenu.aspx';</script>")
    End Sub
0
Comment
Question by:bullrout
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
10 Comments
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12108678
Try using Register script..
            Dim ScriptStr As String = "<Script language='javascript'>window.parent.document.frames(1).location.href='sidemenu.aspx';</script>"
            Page.RegisterStartupScript("MyScript", ScriptStr)

-Baan
0
 
LVL 5

Author Comment

by:bullrout
ID: 12108865
Hey Baan,

I tried this but it does not seem to work at all, do you have any other ideas?

Sean
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12108921
Is your script alright ?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 6

Expert Comment

by:viola123
ID: 12109086
this should work:

Public Sub lstStates_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstStates.SelectedIndexChanged
        Label1.Text = lstStates.SelectedItem.Value
        Response.Write("
                               <Script language='javascript'>
                                       window.parent.document.frames(1).src='sidemenu.aspx';</script>")
End Sub


cheers
viola
0
 
LVL 6

Expert Comment

by:viola123
ID: 12109092
alternatively,

i often implment the frame reload in this way:

let's say that you have a frame like this: <iframe id="myMenuFrame" src="initMenu.aspx"></iframe>

Public Sub lstStates_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstStates.SelectedIndexChanged
        Label1.Text = lstStates.SelectedItem.Value
        Response.Write("
                               <Script language='javascript'>
                                       top.myMenuFrame.src='sidemenu.aspx';</script>")
End Sub

that is my normal way to reference a frame

cheers
viola
0
 
LVL 6

Expert Comment

by:viola123
ID: 12109096
sorry, i forget to reload it ,please check this code in my project:

            var oFrame = document.getElementById("frameActiveCart");
            if (oFrame != null)      {
                  oFrame.src = "activecart.aspx";
                  window.frames.frameActiveCart.window.location.reload();
            }

good luck

viola
0
 
LVL 5

Author Comment

by:bullrout
ID: 12109869
Hi Baan,

The function you gave me does work as I tried to change the "frames(1).src" to reload the page into another frames and it seemed to reload the frame into other target frames. I apologise, because I didn't see the page change untill I place a querystring inside the redirect and then wrote the value to a label control.

Thanks for the help, I really appreciate it, thanks to viola123 as well, however I think that Baan's solution i smore suited to my application.

Sean
0
 
LVL 5

Author Comment

by:bullrout
ID: 12109893
Sorry Baan,

One more question if possible? Could you tell me the syntax that I need to use in order to have a querystring value inside the script block?

I tried the syntax below but I returns an error.

Sean

  Dim ScriptStr As String = "<Script language='javascript'>window.parent.document.frames(1).location.href='sidemenu.aspx?id=<%=strList1%>';</script>"
        Page.RegisterStartupScript("MyScript", ScriptStr)
0
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 500 total points
ID: 12111411
concate it..

 Dim ScriptStr As String = "<Script language='javascript'>window.parent.document.frames(1).location.href='sidemenu.aspx?id=" & strList1.SelectedItem.Value & "';</script>"
        Page.RegisterStartupScript("MyScript", ScriptStr)

-Baan
0
 
LVL 5

Author Comment

by:bullrout
ID: 12118270
Hi Baan,

Thanks for that, it worked like a treat.

Sean
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question