?
Solved

reloading a frame within a listbox SelectedIndexChanged event?

Posted on 2004-09-20
10
Medium Priority
?
589 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 2000 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

Independent Software Vendors: 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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

752 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