Using Frame

P

powerranger

I have aspx page called test.aspx where I create a frameset. At the
top frame, I have dropdownlist box which has autopostback turned on, a
hidden image (visible = false) and a button. When the user chooses an
item from the dropdownlist box (after postback), I want to
show/display the image in the top frame. How can I achieve this
working with a frame. Here is my HTML code:

<frame name="header" src="top.aspx" scrolling="no" noresize>
<frame name="main" src="bottom.aspx">

I already try - parent.frames['top'].location.reload() - but it keeps
on displaying test.aspx in the bottom frame showing the dropdownlist
box, the image, and the button. Please help. Thanks.
 
J

Jose Suero

I tried it and it worked fine

I place a frameset on a one page

a dropdownlist with autopost back on the top frame and a on
selectedindexchange event on code behind and it works perfectly


instead of changing the visible property of a image I changed the text
of a label, but I really don't think it makes much of a difference

here's the code

webform1.aspx:

<HTML>
<HEAD>
<TITLE>WebForm1</TITLE>
</HEAD>
<frameset rows="64,*">
<frame name="header" scrolling="no" noresize src="webform2.aspx">
<frame name="main" src="webform5.aspx">
</frameset>
</HTML>

with no code-behind

webform2.aspx
<HTML>
<HEAD>
<title>WebForm2</title>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT:
8px; POSITION: absolute; TOP: 8px"
runat="server" AutoPostBack="True">
<asp:ListItem Value="yes">yes</asp:ListItem>
<asp:ListItem Value="no">no</asp:ListItem>
</asp:DropDownList>
<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 104px; POSITION:
absolute; TOP: 8px" runat="server">Label</asp:Label></form>
</body>
</HTML>

webform2.aspx.vb

Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Label1.Text = "hello"
End Sub

This works on my machine let me know what's not working for you

Jose
 
J

John Lee

Jose,

Thank you it worked. In your sample, what if you have a button on
WebForm2. When click on it, I want to display something in the bottom
of the frame (or WebForm5). Thanks.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
J

Jose Suero

They're several ways to do this, but they all require client side
scripting

The first one that comes to mind is putting a literal control on
webform2 on the click event button you would put something like
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Literal1.Text =
"<script>parent.main.location.replace('webform5.aspx?text=joseph')</script>"
End Sub

for example in wich you can pass a parameter to the form on webform5
you would have somehting like:

Label1.Text = Request("text")

you can pass other parameters to make the form do what you need it to
do

Hope it helps

Jose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top