Question

Never seen this before in ASP.NET development. I'm trying to refactor out 40 single-page ASP.NET pages to code-behind style.

What does this code do?

// Validate required parameters (if "new", then nothing is required)
if (!this.IsNew())
{
  if (string.IsNullOrEmpty(_billId))
  {
    responseErrorNo = 4;
    Utils.SendError(respErrNum);
  }
}

Its on a single-page design ASP.NET page in the block in the Page_Load method.

On a code-behind page this code ( .IsNew) is not recognized. What am I missing here? Is there an MSDN page on IsNew of the "page"?

update Ok. This is my dumbkoff move of the day. There was a little method hidding at the bottom of the server-side was protected bool IsNew()

see comments about the inheritance point. http://msdn.microsoft.com/en-us/library/015103yb.aspx

Was it helpful?

Solution

Have you done a search through all the source files for IsNew?

Some possibilities
1. This is a method inherited from a base class, if you have one of course
2. IsNew might be an extension method. http://msdn.microsoft.com/en-us/library/bb383977.aspx
3. IsNew is a member of the class

OTHER TIPS

If your code-behind file inherits from a custom page class, as in a class like PageBase instead of the standard System.Web.UI.page, the IsNew could be in there, and maybe your page needs to implement that... ALtneratively, it could be an extension method for the page class, and your missing the namespace reference to include it...

HTH.

This is puzzling as the System.Web.UI.Page class definitely has no IsNew() method. The only way you would get that is if the page is inheriting from a base page, or perhaps if it there is an extension method that extends Page.

Can you right-click the method in Visual Studio and find the definition?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top