Saturday, February 21, 2009

Compiling, Packaging and Deploying [Part One]

Compiling, Packaging and Deploying [Part One]

Question 1: How do you deploy your web application, “MyApp”, to a virtual directory “MyApp” of www.ASPCert.com where the user interface should be updatable and there shouldn’t be a delay when the web pages are accessed for the first time?

By compiling and deploying the application as:

aspnet_compiler -v /MyApp -u "http://www.ASPCert.com/MyApp"



Original questions authored by G. R. Roosta


ASPX Page [Part One]

Page [Part One]

Question 1: What is the order of events fired when an ASPX page is loaded and displayed?


9 events are fired in this order:

  • PreInit
  • Init
  • InitComplete
  • PreLoad
  • Load
  • LoadComplete
  • PreRender
  • PreRenderComplete
  • Unload



Original questions authored by G. R. Roosta

ASP.NET MVC Framework

ASP.NET MVC Framework

Model–View–Controller (MVC) is an architectural pattern in software engineering. This pattern isolates business logic from user interface leading to applications that modifying the visual appearance and the biz rules can be performed independently.
In MVC, the model represents data of the application, the controller manages the communication between data and the biz rules (to manipulate data) and the view corresponds to items in the user interface (pages/forms and controls).
ASP.NET MVC provides a MVC framework on top of the existing ASP.NET 3.5 runtime. This new framework defines a pattern to the web application folder structure and provides a controller base-class to handle and process requests for “actions”. Developers can use the specific Visual Studio 2008 MVC templates to create MVC web applications (You can download it from:
http://www.microsoft.com/downloads/details.aspx?FamilyID=f4e4ee26-4bc5-41ed-80c9-261336b2a5b6). MVC framework is extensible allowing developers to create sophisticated structures that meet their needs, including for example Dependency Injection techniques, new view rendering engines or specialized controllers. As ASP.NET MVC framework is built on ASP.NET 3.5, developers can also take advantage of the existing ASP.NET 3.5 features with this framework.

Tuesday, February 10, 2009

Creating Server Controls [Part One]

Creating Server Controls [Part One]


Question 1: How do you declare the class a server control that must support data binding and data paging?

The class should inherit from DataBoundControl and implement the IPageableItemContainer interface; for example:

public class MyClass : DataBoundControl, IPageableItemContainer
{
   ...
}



Original questions authored by G. R. Roosta

Sunday, February 8, 2009

WCF & ASP.NET 3.5 Web Services [Part One]

WCF & ASP.NET 3.5 Web Services [Part One]

Question 1: How are ASP.NET web services set to work with ASP.NET AJAX scripts?

The attribute [System.Web.Script.Services.ScriptService] is set for the class of each web service. This attribute indicates that a web service may be invoked from script.

Example:

[WebService(Namespace = "http://www.aspcert.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld( )
{
return "Hello World";
}
}



Original questions authored by G. R. Roosta

My New Blog: Questions in ASP.NET 3.5

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - -


See my new blog, Questions in ASP.NET 3.5, at http://aspnet35questions.blogspot.com/



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - -

Data Binding in ASP.NET 3.5 [Part One]

Data Binding in ASP.NET 3.5 [Part One]

Question 1: What does the ConflictDetection property of the SqlDataSource control?

The ConflictDetection property allows us to ask the SqlDataSource control what kind of conflict detection to use when updating the bound data. This determines what action should be performed if more than one user attempt to edit or delete the same data.

There are two possible values for this property:

1) OverwriteChange: The data source control overwrites all values in a data row with its own values for the row.
2) CompareAllValues: The data source control employs the OldValues collection of the Update and Delete methods to determine whether the data has been changed by another process.

For more info click here.


Question 2: What does the Select property of the LinqDataSource control?

It can be used to control the selection of data from the context object. For example, in the following source:


<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="NorthwindDataContext"
TableName="Customers"<span >Select</span>="new (CustomerID, ContactName)">
</asp:LinqDataSource>


binding LinqDataSource1 to a GridView makes just the two specified fields be displayed. If no Select property is specified, the LinqDataSource control returns all the public properties exposed by the data object.

A side effect of using this property is that the resulting data source no longer supports the inserting, updating or deletion of data. So to limit the data shown by the bound control, we may consider specifying the fields in the bound list control rather than in the LinqDataSource control.


Original questions authored by G. R. Roosta