How to change src in a frameset frame based on ListBox selection

Posted on 2005-03-08
Medium Priority
Last Modified: 2007-12-19

This is my first attempt at using Web Forms (my previous experience has only been with Windows forms and this seems to be Worlds different) and I am having a tough time figuring out how to do the following:

I have a Frameset that has a header, footer, contents and main section.  When the .htm form is loaded a listBox is populated and displayed in frame Contents, and the frame Main displays a generic .aspx form (that has an image on it).  

What I would like to be able to do is when the user makes a selection from the ListBox, that a different form gets loaded into the Frame Main - replace the wfSplash.aspx with wfViewer.aspx.

Can someone give me some idea on how to do this?  I am using VB.Net, and have had little/no experience with VB script or Java script - not sure if it's needed here, most of what I'm trying to do is very new to me.

Snippet from the frmMain.htm page when loaded:

       <frameset rows="67,78%,32">
            <frame name="header" src="wfHeader.aspx" noResize scrolling="no">
            <frameset cols="143,77%">
                  <frame name="contents" src="wfReportList.aspx">
                  <frame name="main" src="wfSplash.aspx" noResize scrolling="no">
            <frame name="footer" src="wfFooter.aspx" noResize scrolling="no">

I need to change
<frame name="main" src="wfSplash.aspx" noResize scrolling="no">
<frame name="main" src="wfViewer.aspx" noResize scrolling="no">
if the user makes a selection in the frame Contents (wfReportList.aspx), ListBox

Hope this makes sense.... Help?

Question by:janmarini
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
  • 2
LVL 13

Expert Comment

ID: 13491924
ok, if you say you have a listbox than it must look something like this right..?

<select name="somename">
      <option value="value1">Value 1</option>
      <option value="value2">Value 2</option>
      <option value="value3">Value 3</option>

add "onchange" event to it like so...

<select name="somename" onchange="top.main.location.href='wfViewer.aspx'">
      <option value="value1">Value 1</option>
      <option value="value2">Value 2</option>
      <option value="value3">Value 3</option>


Author Comment

ID: 13492699
I'm answering my own question....Uses a javascript in the code behind on the form that has the List Box control to change the (src) .aspx in the parent frame

Private Sub lbReportList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbReportList.SelectedIndexChanged
        Dim strReport As String = lbReportList.SelectedItem.Value
        Select Case strReport
            Case "IS Call Details"
                Dim ScriptStr As String = "<Script language='javascript'>window.parent.document.frames(2).location.href='wfCriteria.aspx';</script>"
                Page.RegisterStartupScript("MyScript", ScriptStr)
            Case "IS Metrics"
                Dim ScriptStr As String = "<Script language='javascript'>window.parent.document.frames(2).location.href='wfViewer.aspx';</script>"
                Page.RegisterStartupScript("MyScript", ScriptStr)
        End Select
LVL 13

Expert Comment

ID: 13495869
so what did I do than..?

Accepted Solution

modulo earned 0 total points
ID: 13527869
Closed, 500 points refunded.

Community Support Moderator
Experts Exchange

Featured Post

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.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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