Ask a Question related to ASP.NET General, Design and Development.
-
Vidar Petursson #1
Re: How to use frmaes with c#
Hi
Not possible with server code
<script>
function go(sPageToGo,sFrameName){
parent.frames[sFrameName].location href = sPageToGo;
}
----
Now for a select... ( framename is always the same )
function go(sPageToGo){
parent:FRAMENAME.location.href = sPageToGo;
}
</script>
<select onchange="go(this.options[this.selectedIndex].value)">
<option value="myPage1.aspx">Bla</option>
<option value="myPage2.aspx">Bla</option>
----
If you want to set target frame... then
<select onchange="go(this.options[this.selectedIndex].value)">
<option value="MYFRAME1,myPage1.aspx">Bla</option>
<option value="MYFRAME2,myPage2.aspx">Bla</option>
function go(sPara){
var a = sPara.split(",");
parent.frames[a[0]].location.href=a[1];
}
--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"Bussiron F." <shamaz@ifranc.com> wrote in message
news:084801c34aba$a4b8c1d0$a601280a@phx.gbl...> The only solution I'v found was to use a script in Jscript
> like this:
>
> Button1.Attributes.Add("onclick","javascript:myscr ipt(1)");
>
> and the code of Myscript is:
>
> <script language="JavaScript">
> function myscript(i)
> {
> parent.frames
> (2).location.href="http://..../mypage.aspx?argument1="+i
> }
> </script>
>
> But there is some issues with this method.
> - I can only execute a my script when an "onclick" event
> happens... And I'd like to use it with a
> SelectedIndexChanged event.
> - It's not easy to change the argument
> in "javascript:myscript(1)", since it is a constant string.
>
> If anybody knows a way to do this only in C#, it would be
> cool.
> .
>
>
Vidar Petursson Guest



Reply With Quote

