Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2005-03-08
5
Medium Priority
?
219 Views
Last Modified: 2007-12-19
Hi,

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">
            </frameset>
            <frame name="footer" src="wfFooter.aspx" noResize scrolling="no">

I need to change
<frame name="main" src="wfSplash.aspx" noResize scrolling="no">
to
<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?

Thanks,
Jan
0
Comment
Question by:janmarini
  • 2
4 Comments
 
LVL 13

Expert Comment

by:davidlars99
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>
</select>

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>
</select>

0
 
LVL 7

Author Comment

by:janmarini
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
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 13495869
so what did I do than..?
0
 

Accepted Solution

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

modulo
Community Support Moderator
Experts Exchange
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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
Screencast - Getting to Know the Pipeline
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

580 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