In VS 2002, I always had View in Browser available on the context menu of a WebForm.
This would let me use a dummy page that loads fast to launch the debugger, then View in Browser to launch the page I need to debug.
In VS 2003, I seem to only have the option to View in Browser when I am not in debug mode and it really bothers me.
I seem to have a choice of constantly changing my start page or navigating "by hand“ to the page, which takes time.
Who thought this was a good idea? Is there a way to make View in Browser always available in VS 2003?
-A
Sometimes you might want to split one of the Page (or UserControl) events up.
A simple scenario is dividing the first load event (IsPostBack==false) from the load event during a postback. The code I've posted fires two additional events after/during page load. It still allows the Load event to be used, but there is some code commented out that throws an exception if you use Load. The same thing can be done with PreRender to fire some sort of PostBackEventsComplete.
The DefaultEventAttribute will cause VS.Net to emit the FirstLoad event handler instead of the Load event.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace AndrewTesting.ModifyPageEventStructure
{
[DefaultEvent("FirstLoad")]
public class PageEx :Page
{
private static readonly object FirstLoadEventKey = new object();
private static readonly object PostBackLoadEventKey = new object();
public PageEx():base()
{
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
private void Page_Load(object sender, System.EventArgs e)
{
if(IsPostBack)
{
OnPostBackLoad(e);
}
else
{
OnFirstLoad(e);
}
}
virtual public void OnFirstLoad(EventArgs e)
{
FireEvent(FirstLoadEventKey,e);
}
virtual public void OnPostBackLoad(EventArgs e)
{
FireEvent(PostBackLoadEventKey,e);
}
private void FireEvent(object key,EventArgs e)
{
FireEvent(key,this,e);
}
private void FireEvent(object key,object sender, EventArgs e)
{
EventHandler eventHandlerDelegate = (EventHandler)Events[key];
if (eventHandlerDelegate != null)
{
eventHandlerDelegate(sender, e);
}
}
// new public event EventHandler Load
// {
// add
// {
// throw new Exception("Load event not allowed");
// }
// remove
// {
// throw new Exception("Load event not allowed");
// }
// }
public event EventHandler FirstLoad
{
add
{
Events.AddHandler(FirstLoadEventKey, value);
}
remove
{
Events.RemoveHandler(FirstLoadEventKey, value);
}
}
public event EventHandler PostBackLoad
{
add
{
Events.AddHandler(PostBackLoadEventKey, value);
}
remove
{
Events.RemoveHandler(PostBackLoadEventKey, value);
}
}
}
}
p.s. It isn't that I use or need this code; I am studying and I just need to write code from time to time.
I found a link to this site looking at the postings about xslt 2.0 and xPath 2.0 in System.Xml V2.0 by Dare Obasanjo and Mark Fussell
99 Bottles of Beer
One program in 621 versions (langauges)
http://www.99-bottles-of-beer.net/
Is there anyone out there who uses Grid layout? I have never seen it used, and I really have no idea why it is the default.
I know that designers don't like this Grid mode, it just helps them argue against using VS.Net
I don't want to dig for this in the future, so I am reposting this link that Marcie just posted:
Change WebForm's pageLayout to Flow forever
Quick summary: Find the DefaultWebProject.csproj and add the attribute DefaultHTMLPageLayout = "Flow" to the <Settings>element.
There are other attributes you can set here: DefaultTargetSchema and DefaultClientScript affect the meta tags.
You can set most of the stuff you see in the Project Properties, you can look at your csproj files to get more ideas.