Question for ASP.NET + HTML guru

G

Guest

Hi,

I am starting a new project to build a software product using APS.NET 2.0.
In past I have used "frameset" and "frame" to build pages. My current
requirements I have coded using frameset and frame like code below.
My question is, because this is a new development is it good to use frameset
and frame or I can use some thing better. I am looking for expert suggestions
on my code below is this a good way to move or I should not use frames.

As you know I am not an ASP.NET expert I am just looking for correct
direction on new ASP.NET development not details.

Thanks a lot,
Ashok

Code
---------
***********
default.htm
***********

<html>
<head>
<script type="text/javascript">

var columntype=""
var defaultsetting=""
var currset3=""
var currset4=""

function getCurrentSetting()
{
if (document.body)
return (document.body.cols) ? document.body.cols :
document.body.rows
}

function setframevalue(coltype, settingvalue)
{
if (coltype=="rows")
document.body.rows=settingvalue
else if (coltype=="cols")
document.body.cols=settingvalue
}

function resizeFrame(contractsetting)
{
if (getCurrentSetting() != defaultsetting)
setframevalue(columntype, defaultsetting)
else
setframevalue(columntype, contractsetting)
}

function init()
{
if (!document.all && !document.getElementById)
return
if (document.body!=null)
{
columntype=(document.body.cols)? "cols" : "rows"
defaultsetting=(document.body.cols)? document.body.cols :
document.body.rows
}
else
setTimeout("init()",100)
}

setTimeout("init()",100)

</script>

</head>
<frameset cols="20%,80%">
<frame src="C:\Temp\tree.htm" scrolling="auto" frameborder="0">
<frame src="C:\Temp\main.htm" scrolling="auto" frameborder="0">
</frameset>
</html>

*********
tree.htm
*********
<html>
<body>
<TABLE style="border-collapse: collapse; border: solid;" WIDTH="100%">
<tr>
<td>
<a href="javascript:parent.resizeFrame('25,*')">+</a>
</td>
</tr>
</TABLE>
</body>
</html>


*********
main.htm
*********
<html>
<head>
<script type="text/javascript">

var columntype=""
var defaultsetting=""
var currset3=""
var currset4=""

function getCurrentSetting()
{
if (document.body)
return (document.body.cols) ? document.body.cols :
document.body.rows
}

function setframevalue(coltype, settingvalue)
{
if (coltype=="rows")
document.body.rows=settingvalue
else if (coltype=="cols")
document.body.cols=settingvalue
}

function resizeFrame(contractsetting)
{
if (getCurrentSetting() != defaultsetting)
setframevalue(columntype, defaultsetting)
else
setframevalue(columntype, contractsetting)
}

function resizeFrame1(contractsetting)
{
if (currset3 == '')
{
currset3=getCurrentSetting()
setframevalue(columntype, contractsetting)

}
else
{
setframevalue(columntype, currset3)
currset3=""
}
}

function resizeFrame2(contractsetting)
{
if (currset4 == '')
{
currset4=getCurrentSetting()
setframevalue(columntype, contractsetting)

}
else
{
setframevalue(columntype, currset4)
currset4=""
}
}

function init()
{
if (!document.all && !document.getElementById)
return
if (document.body!=null)
{
columntype=(document.body.cols)? "cols" : "rows"
defaultsetting=(document.body.cols)? document.body.cols :
document.body.rows
}
else
setTimeout("init()",100)
}

setTimeout("init()",100)

</script>

</head>
<frameset rows="50%,40%,5%,5%">
<frame src="C:\Temp\page1.htm" scrolling="auto" frameborder="0">
<frame src="C:\Temp\page2.htm" scrolling="auto" frameborder="0">
<frame src="C:\Temp\page3.htm" scrolling="auto" frameborder="0">
<frame src="C:\Temp\page4.htm" scrolling="auto" frameborder="0">
</frameset>
</html>

**********
page1.htm
**********
<html>
<body>
<TABLE style="border-collapse: collapse; border: solid;" WIDTH="100%">
<tr>
<td>
<a href="javascript:parent.resizeFrame('44,*,44,44')">Page 1</a>
</td>
</tr>
</TABLE>
</body>
</html>

**********
page2.htm
**********
<html>
<body>
<TABLE style="border-collapse: collapse; border: solid;" WIDTH="100%">
<tr>
<td>
<a href="javascript:parent.resizeFrame('44,*,44,44')">Page 2</a>
</td>
</tr>
</TABLE>
</body>
</html>

**********
page3.htm
**********
<html>
<body>
<TABLE style="border-collapse: collapse; border: solid;" WIDTH="100%">
<tr>
<td>
<a href="javascript:parent.resizeFrame1('44,44,*,44')">Page 3</a>
</td>
</tr>
</TABLE>
</body>
</html>

***********
page4.htm
***********
<html>
<body>
<TABLE style="border-collapse: collapse; border: solid;" WIDTH="100%">
<tr>
<td>
<a href="javascript:parent.resizeFrame2('44,44,44,*')">Page 4</a>
</td>
</tr>
</TABLE>
</body>
</html>
 
G

gregnowlives

You could use Masterpages. Give them a readup. All the functionality I
can think of is availible via these.

Thanks

Greg
 
D

darrel

My question is, because this is a new development is it good to use
frameset
and frame or I can use some thing better.

Frames are rarely a good idea.

To better answer your question, we need to know WHY you chose to use Frames
in the first place.

If you were using it to organize your page layout, odds are that you'd be
better off using CSS.

If you were using it to maintain common components, odds are that you'd be
better off using webControls.

-Darrel
 
G

Guest

Thank you Darrel. To give you more details, my front end may look like msdn
site not same just to give you some idea... on left frame tree control on
right side 4 frames which can be collapse and expand. On first frame I have
controls like list box and buttons, second frame has also same controls but
list box will populate base on selection on first frame, third frame will
have all dynamic controls (list, text, dropdown,cal.) generation. and forth
frame I am planning to put Grid View which I use now OWC (PivotTable)
control. When button clicked on first frame (Run Query) I want to read data
from all the frames build Query Request (may be xml) get the data from
database and show data on forth frame's Grid View.
Frames works fine now because when user selects any thing on first frame my
whole page doesn't do post back (for users they don't like flicker on page).
Even there are lots of Java scripts but some how it's easy now working with
different frames.
There are also lot of data stored in session as you see in the third frame I
have dynamic controls and data all saved in session.
Tree control on left should also expand and collapse to left.
User wants frames to collapse because once they run the query they want full
page to see data (Grid View) on forth frame. Hope you got the idea.
I need help to get correct direction what I should use because I am starting
again in .net 2.0 and want to use if there are any better framework for my
development.

Thanks a lot - Ashok
 
D

darrel

Frames works fine now because when user selects any thing on first frame
my
whole page doesn't do post back (for users they don't like flicker on
page).

I wouldn't use frames to just get rid of the 'flicker'. Loading pages on the
internet is how the web pretty much works. People are used to it. It's not a
'bug' to fix.

So, instead of frames, I'd use web controls. One for your menu, a handful
for your content, etc.
Even there are lots of Java scripts but some how it's easy now working
with
different frames.

Getting Javascript to behave across frames is a chore. Another reason to
drop the frames.
There are also lot of data stored in session as you see in the third frame
I
have dynamic controls and data all saved in session.

This might be a reason to use frames. You might also be able to use
viewstates instead, though.
User wants frames to collapse because once they run the query they want
full
page to see data (Grid View) on forth frame. Hope you got the idea.
I need help to get correct direction what I should use because I am
starting
again in .net 2.0 and want to use if there are any better framework for my
development.

If you are ambitious, check out using usercontrols for your compoents, and
CSS + AJAX for your interface. AJAX will give you the layout control you are
looking and allow you to not have to do full page reloads without having to
deal with frames.

-Darrel
 
C

Ciaran

You should use master pages, they give the same functionality for
reusability of markup etc but avoid the frames which are increasingly
considered outdated and a bad idea. Frames arent supported on all platforms
like mobiles and pda's whereas master pages produce normal markup so could
be view on those platforms.

HTH

Ciaran
 
L

Laurent Bugnion

Hi,
You should use master pages, they give the same functionality for
reusability of markup etc but avoid the frames which are increasingly
considered outdated and a bad idea. Frames arent supported on all platforms
like mobiles and pda's whereas master pages produce normal markup so could
be view on those platforms.

HTH

Ciaran

While I generally agree that frames should rather be avoided, it is
incorrect that PDAs are unable to handle them. Popular PalmOS browsers
like Blazer, AvantGo or Xiino all have their own way to deal with
frames. Blazer displays all the frames on the same page (same effect
than if you were using Masterpages), Xiino has a frame navigation button
which allows you to switch between frames.

Having frames on a page doesn't mean that your page won't be useful on
mobile devices anymore.

HTH,
Laurent
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top