Solved

reloading a frame within a listbox SelectedIndexChanged event?

Posted on 2004-09-20
10
576 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now