Solved

reloading a frame within a listbox SelectedIndexChanged event?

Posted on 2004-09-20
10
579 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
  • 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

803 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