DotNet Academy of Rajesh Rolen

Solutions by Rajesh Rolen

Check/ Uncheck all child nodes of a node in TreeView

when we need to Check/ Uncheck all chield nodes of anynode in TreeView we need to create a recursive function which will do check all to all child nodes of the current node and voice-versa.

Private Sub tvrights_AfterCheck(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvrights.AfterCheck
RemoveHandler tvrights.AfterCheck, AddressOf tvrights_AfterCheck
CheckChildNode(e.Node)
CheckParentNode(e.Node)
AddHandler tvrights.AfterCheck, AddressOf tvrights_AfterCheck
End Sub



Private Sub CheckChildNode(ByVal currNode As TreeNode)
'set the children check status to the same as the current node
Dim checkStatus As Boolean = currNode.Checked
For Each node As TreeNode In currNode.Nodes
node.Checked = checkStatus
CheckChildNode(node)
Next
End Sub

Private Sub CheckParentNode(ByVal currNode As TreeNode)
Dim parentNode As TreeNode = currNode.Parent
If parentNode Is Nothing Then Exit Sub
parentNode.Checked = True
For Each node As TreeNode In parentNode.Nodes
If Not node.Checked Then
parentNode.Checked = False
Exit For
End If
Next
CheckParentNode(parentNode)
End Sub

Check/ Uncheck all child nodes of a node in TreeView

when we need to Check/ Uncheck all chield nodes of anynode in TreeView we need to create a recursive function which will do check all to all child nodes of the current node and voice-versa.

Private Sub tvrights_AfterCheck(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvrights.AfterCheck
RemoveHandler tvrights.AfterCheck, AddressOf tvrights_AfterCheck
CheckChildNode(e.Node)
CheckParentNode(e.Node)
AddHandler tvrights.AfterCheck, AddressOf tvrights_AfterCheck
End Sub



Private Sub CheckChildNode(ByVal currNode As TreeNode)
'set the children check status to the same as the current node
Dim checkStatus As Boolean = currNode.Checked
For Each node As TreeNode In currNode.Nodes
node.Checked = checkStatus
CheckChildNode(node)
Next
End Sub

Private Sub CheckParentNode(ByVal currNode As TreeNode)
Dim parentNode As TreeNode = currNode.Parent
If parentNode Is Nothing Then Exit Sub
parentNode.Checked = True
For Each node As TreeNode In parentNode.Nodes
If Not node.Checked Then
parentNode.Checked = False
Exit For
End If
Next
CheckParentNode(parentNode)
End Sub

Visit all Nodes of TreeView

when we need to traverse all nodes of a treeview then we will have to create a recursive function.
In below example we are showing how to visit all nodes of treeview.
eg:-

Private Sub TraverseTreeView(ByVal tview As TreeView)
Dim temp As New TreeNode
For k As Integer = 0 To tview.Nodes.Count - 1
temp = tview.Nodes(k)
messagebox.show(temp) 'this will show node text
For i As Integer = 0 To temp.Nodes.Count - 1
visitChildNodes(temp.Nodes(i))
Next
Next
End Sub

Private Sub visitChildNodes(ByVal node As TreeNode)

messagebox.show(node) 'this will show node text
For j As Integer = 0 To node.Nodes.Count - 1
visitChildNodes(node.Nodes(j))
Next
End Sub

Visit all Nodes of TreeView

when we need to traverse all nodes of a treeview then we will have to create a recursive function.
In below example we are showing how to visit all nodes of treeview.
eg:-

Private Sub TraverseTreeView(ByVal tview As TreeView)
Dim temp As New TreeNode
For k As Integer = 0 To tview.Nodes.Count - 1
temp = tview.Nodes(k)
messagebox.show(temp) 'this will show node text
For i As Integer = 0 To temp.Nodes.Count - 1
visitChildNodes(temp.Nodes(i))
Next
Next
End Sub

Private Sub visitChildNodes(ByVal node As TreeNode)

messagebox.show(node) 'this will show node text
For j As Integer = 0 To node.Nodes.Count - 1
visitChildNodes(node.Nodes(j))
Next
End Sub

Custom Page Size Crystal Report by Code

Dim oRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oRpt.Load(Server.MapPath("CrystalReport.rpt"))
oRpt.PrintOptions.PaperOrientation = [Shared].PaperOrientation.Portrait
oRpt.PrintOptions.PaperSize = [Shared].PaperSize.PaperEnvelope10

CrystalReportViewer1.ReportSource = oRpt

Custom Page Size Crystal Report by Code

Dim oRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
oRpt.Load(Server.MapPath("CrystalReport.rpt"))
oRpt.PrintOptions.PaperOrientation = [Shared].PaperOrientation.Portrait
oRpt.PrintOptions.PaperSize = [Shared].PaperSize.PaperEnvelope10

CrystalReportViewer1.ReportSource = oRpt

Repair a database

Repair a database

To determine whether a database needs to be repaired run:

dbcc checkdb('DB-NAME') with no_infomsgs
replacing 'DB-NAME' with the name of the database.

If this completes without displaying any errors then the database does not need to be repaired.

If the errors that come back contain lines saying:

... Run DBCC UPDATEUSAGE
Then the database does not need to be repaired, simply run:

dbcc updateusage('DB-NAME') with no_infomsgs
If a database does need to be repaired then:

if you can identify why the database needs to be repaired. Look in the windows system and application event logs to see if any problems have been logged which might account for the problem. For example is the problem caused by a failing disk? Often you will not be able to identify the cause, but if you can then remember to address it.
it is suggested that instead of repairing the database it be restored from the last reliable backup.
To repair a database the database must first be placed into single user mode:

alter database DB-NAME set SINGLE_USER

once the database is in single user mode it can be repaired. There are a number of repair options but the two typically used are "REPAIR_REBUILD" and "REPAIR_ALLOW_DATA_LOSS". I suggest in the first instance using:

dbcc checkdb('DB-NAME',REPAIR_REBUILD)
this will make any repairs that SQL Server can perform without the loss of data.

If (and only if) SQL Server cannot repair the database without the loss of data then use:

dbcc checkdb('DB-NAME',REPAIR_ALLOW_DATA_LOSS)
once the database has been repaired it should be switched out of single user mode and back into multi-user mode:

set database DB-NAME set MULTI_USER
These notes have been tested against SQL Server 2005 running under Windows 2008 Standard Server.

Repair a database

Repair a database

To determine whether a database needs to be repaired run:

dbcc checkdb('DB-NAME') with no_infomsgs
replacing 'DB-NAME' with the name of the database.

If this completes without displaying any errors then the database does not need to be repaired.

If the errors that come back contain lines saying:

... Run DBCC UPDATEUSAGE
Then the database does not need to be repaired, simply run:

dbcc updateusage('DB-NAME') with no_infomsgs
If a database does need to be repaired then:

if you can identify why the database needs to be repaired. Look in the windows system and application event logs to see if any problems have been logged which might account for the problem. For example is the problem caused by a failing disk? Often you will not be able to identify the cause, but if you can then remember to address it.
it is suggested that instead of repairing the database it be restored from the last reliable backup.
To repair a database the database must first be placed into single user mode:

alter database DB-NAME set SINGLE_USER

once the database is in single user mode it can be repaired. There are a number of repair options but the two typically used are "REPAIR_REBUILD" and "REPAIR_ALLOW_DATA_LOSS". I suggest in the first instance using:

dbcc checkdb('DB-NAME',REPAIR_REBUILD)
this will make any repairs that SQL Server can perform without the loss of data.

If (and only if) SQL Server cannot repair the database without the loss of data then use:

dbcc checkdb('DB-NAME',REPAIR_ALLOW_DATA_LOSS)
once the database has been repaired it should be switched out of single user mode and back into multi-user mode:

set database DB-NAME set MULTI_USER
These notes have been tested against SQL Server 2005 running under Windows 2008 Standard Server.

Static Class

Static classes are used when a class provides functionality that is not specific to any unique instance. Here are the features of static classes in C# 2.0.

Static classes can not be instantiated.
Static classes are sealed so they can not be inherited.
Only static members are allowed.
Static classes can only have static constructor to initialize static members.
Advantages

Compiler makes sure that no instance of static class is created. In previous version of C#, the constructor has to be marked private to avoid this from happening.

Also compiler makes sure that no instance members are declared within a static class.

Sample:

Public static class MyStaticClass
{
Private static int _staticVariable;
Public static int staticVariable;
{
Get
{
Return _staticVariable;
}
Set
{
_staticVariable = value;
}
}
Public static void Function()
{
}
}

--------------***********************----------------------------------------
A static class is defined as a class that contains only static members (of course besides the instance members inherited from System.Object and possibly a private constructor). Some languages provide built-in support for static classes. In C# 2.0, when a class is declared to be static, it is sealed, abstract, and no instance members can be overridden or declared.
public static class File {
...
}
If your language does not have built-in support for static classes, you can declare such classes manually as in the following C++ example:
public class File abstract sealed {
...
}
Static classes are a compromise between pure object-oriented design and simplicity. They are commonly used to provide shortcuts to other operations (such as System.IO.File), or functionality for which a full object-oriented wrapper is unwarranted (such as System.Environment).
DO use static classes sparingly.
Static classes should be used only as supporting classes for the object-oriented core of the framework.
DO NOT treat static classes as a miscellaneous bucket.
There should be a clear charter for the class.
DO NOT declare or override instance members in static classes.
DO declare static classes as sealed, abstract, and add a private instance constructor, if your programming language does not have built-in support for static classes.

Example of Static Class in C#.net

using System;

static class MathFunction {
// Return the reciprocal of a value.
static public double reciprocal(double num) {
return 1/num;
}

// Return the fractional part of a value.
static public double fracPart(double num) {
return num - (int) num;
}

// Return true if num is even.
static public bool isEven(double num) {
return (num % 2) == 0 ? true : false;
}

// Return true of num is odd.
static public bool isOdd(double num) {
return !isEven(num);
}

}

class MainClass {
public static void Main() {
Console.WriteLine("Reciprocal of 5 is " +
MathFunction.reciprocal(5.0));

Console.WriteLine("Fractional part of 4.234 is " +
MathFunction.fracPart(4.234));

if(MathFunction.isEven(10))
Console.WriteLine("10 is even.");

if(MathFunction.isOdd(5))
Console.WriteLine("5 is odd.");

// The following attempt to create an instance of
// MathFunction will cause an error.
// MathFunction ob = new MathFunction(); // Wrong!
}
}

Static Class

Static classes are used when a class provides functionality that is not specific to any unique instance. Here are the features of static classes in C# 2.0.

Static classes can not be instantiated.
Static classes are sealed so they can not be inherited.
Only static members are allowed.
Static classes can only have static constructor to initialize static members.
Advantages

Compiler makes sure that no instance of static class is created. In previous version of C#, the constructor has to be marked private to avoid this from happening.

Also compiler makes sure that no instance members are declared within a static class.

Sample:

Public static class MyStaticClass
{
Private static int _staticVariable;
Public static int staticVariable;
{
Get
{
Return _staticVariable;
}
Set
{
_staticVariable = value;
}
}
Public static void Function()
{
}
}

--------------***********************----------------------------------------
A static class is defined as a class that contains only static members (of course besides the instance members inherited from System.Object and possibly a private constructor). Some languages provide built-in support for static classes. In C# 2.0, when a class is declared to be static, it is sealed, abstract, and no instance members can be overridden or declared.
public static class File {
...
}
If your language does not have built-in support for static classes, you can declare such classes manually as in the following C++ example:
public class File abstract sealed {
...
}
Static classes are a compromise between pure object-oriented design and simplicity. They are commonly used to provide shortcuts to other operations (such as System.IO.File), or functionality for which a full object-oriented wrapper is unwarranted (such as System.Environment).
DO use static classes sparingly.
Static classes should be used only as supporting classes for the object-oriented core of the framework.
DO NOT treat static classes as a miscellaneous bucket.
There should be a clear charter for the class.
DO NOT declare or override instance members in static classes.
DO declare static classes as sealed, abstract, and add a private instance constructor, if your programming language does not have built-in support for static classes.

Example of Static Class in C#.net

using System;

static class MathFunction {
// Return the reciprocal of a value.
static public double reciprocal(double num) {
return 1/num;
}

// Return the fractional part of a value.
static public double fracPart(double num) {
return num - (int) num;
}

// Return true if num is even.
static public bool isEven(double num) {
return (num % 2) == 0 ? true : false;
}

// Return true of num is odd.
static public bool isOdd(double num) {
return !isEven(num);
}

}

class MainClass {
public static void Main() {
Console.WriteLine("Reciprocal of 5 is " +
MathFunction.reciprocal(5.0));

Console.WriteLine("Fractional part of 4.234 is " +
MathFunction.fracPart(4.234));

if(MathFunction.isEven(10))
Console.WriteLine("10 is even.");

if(MathFunction.isOdd(5))
Console.WriteLine("5 is odd.");

// The following attempt to create an instance of
// MathFunction will cause an error.
// MathFunction ob = new MathFunction(); // Wrong!
}
}

Difference between Function Overriding and Function Overloading

Difference between Function Overriding and Function Overloading

Overriding is the example of run-time polymorphism and
Overloading is the example of compile-time polymorphism.

The Compile-Time polymorphism have early binding and
Runtime polymorphism have late binding.

The Compile-Time polymorphism is Static and
Runtime polymorphism is Dynamic.

Overriding
¦The return type must exactly match that of the overridden method (Note:- in some languages we can change Return type in overriding).

¦The access level must not be more restrictive than that of the overridden method.

¦The access level can be less restrictive than that of the overridden method.

¦The overriding method must not throw new or broader checked exceptions than those declared by the overridden method.

¦The overriding method can throw narrower or fewer exceptions. Just because an overridden method “takes risks” doesn’t mean that the overriding subclass’ exception takes the same risks. Bottom line: An overriding method doesn’t have to declare any exceptions that it will never throw, regardless of what the overridden method declares.

¦You cannot override a method marked final.

¦Overriding is only possible through inheritance.

¦If a method can’t be inherited, you cannot override it.

Overloaded method
¦Overloaded methods must change the argument list (you can do change in argument list by 1. changing datatype of parameters, 2. changing sequence of parameters, 3. changing count of parameters).

¦Overloaded methods can change the return type (mins its doesn't make any difference that either you change return type or not. its not matter for overloading)

¦Overloaded methods can change the access modifier.

¦Overloaded methods can declare new or broader checked exceptions.

¦A method can be overloaded in the same class or in a subclass.

NOTE:- all most all object oriented languages supports function overloading and function overriding and some of languages also supports operator overloading like : c#.net , c++ etc and some languages not support operator overloading like: vb.net but no language support operator overriding.

Difference between Function Overriding and Function Overloading

Difference between Function Overriding and Function Overloading

Overriding is the example of run-time polymorphism and
Overloading is the example of compile-time polymorphism.

The Compile-Time polymorphism have early binding and
Runtime polymorphism have late binding.

The Compile-Time polymorphism is Static and
Runtime polymorphism is Dynamic.

Overriding
¦The return type must exactly match that of the overridden method (Note:- in some languages we can change Return type in overriding).

¦The access level must not be more restrictive than that of the overridden method.

¦The access level can be less restrictive than that of the overridden method.

¦The overriding method must not throw new or broader checked exceptions than those declared by the overridden method.

¦The overriding method can throw narrower or fewer exceptions. Just because an overridden method “takes risks” doesn’t mean that the overriding subclass’ exception takes the same risks. Bottom line: An overriding method doesn’t have to declare any exceptions that it will never throw, regardless of what the overridden method declares.

¦You cannot override a method marked final.

¦Overriding is only possible through inheritance.

¦If a method can’t be inherited, you cannot override it.

Overloaded method
¦Overloaded methods must change the argument list (you can do change in argument list by 1. changing datatype of parameters, 2. changing sequence of parameters, 3. changing count of parameters).

¦Overloaded methods can change the return type (mins its doesn't make any difference that either you change return type or not. its not matter for overloading)

¦Overloaded methods can change the access modifier.

¦Overloaded methods can declare new or broader checked exceptions.

¦A method can be overloaded in the same class or in a subclass.

NOTE:- all most all object oriented languages supports function overloading and function overriding and some of languages also supports operator overloading like : c#.net , c++ etc and some languages not support operator overloading like: vb.net but no language support operator overriding.

Special folders in ASP.Net

With the release of ASP.NET 2.0, Microsoft has greatly increased the power of ASP.Net by introducing a suite of new features and functionalities.

ASP.Net defines several special folders. When a new Web site is created the App_Data folder is created by default; it can contain a SQL Server 2005 Express Edition database, another database, or an XML data file that will be used in the Web site.

These folders are also data directories.

~:App_Browsers folder - Contains browser definitions (.browser files) files that ASP.Net uses to identify individual browsers and determine their capabilities. Browser definition files are used to determine the client browser capabilities. These files are often used to help support mobile application.

~:App_Data folder - App_Data folder is used to store file that can be used as database files (.mdf, .mdb and xml files). The user account that is used to run the application (for example, the local ASPNET account) has permissions to read, write, and create files in this folder. Various ASP.NET application features, such as the providers for membership and roles, as well as the Web Site Administration Tool, are configured to work with the App_Data folder specifically.

~:Bin folder - Contains compiled assemblies (.dll files), for code that you want to reference in your application, as in earlier versions of Visual Studio. Any classes represented by code in the Bin folder are automatically referenced in your Web site.

~:App_LocalResources folder - Contains .resx files that are bound to a specific page. You can define multiple .resx files for each page, each .resx file representing a different language or language/culture combination.

~:App_GlobalResource folder - Like the App_LocalResources folders, but contains .resx files that are not bound to a specific page. Resource values in .resx files in the App_GlobalResource folders can be accessed programmatically from application code.

~:App_Code folder - Contains source code files. The code is compiled as part of your application and is referenced automatically. The App_Code folder works much like the Bin folder, except that you can put source code in it instead of compiled code. While you are working in Visual Web Developer, the source code in the App_Code folder is compiled dynamically so that IntelliSense can reference any classes defined in the files.

~:App_Themes folder - Contain sub-folders that each defines a specific theme or look and feel for you Web site. Sub-folders consist of a collection of files (such as .skin, .css and image files) that define the appearance of ASP.Net Web pages and controls.

~:App_WebReferences folder - Contains files used to create a reference to a Web service (in the same project or external to the project), including .disco, .xsd, .discomap and .wsdl files.

Note: Special folders can be added to a Web site from the Visual Studio menu system. Typically this involves right-clicking the Web Application project and selecting Add ASP.NET folder.

Special folders in ASP.Net

With the release of ASP.NET 2.0, Microsoft has greatly increased the power of ASP.Net by introducing a suite of new features and functionalities.

ASP.Net defines several special folders. When a new Web site is created the App_Data folder is created by default; it can contain a SQL Server 2005 Express Edition database, another database, or an XML data file that will be used in the Web site.

These folders are also data directories.

~:App_Browsers folder - Contains browser definitions (.browser files) files that ASP.Net uses to identify individual browsers and determine their capabilities. Browser definition files are used to determine the client browser capabilities. These files are often used to help support mobile application.

~:App_Data folder - App_Data folder is used to store file that can be used as database files (.mdf, .mdb and xml files). The user account that is used to run the application (for example, the local ASPNET account) has permissions to read, write, and create files in this folder. Various ASP.NET application features, such as the providers for membership and roles, as well as the Web Site Administration Tool, are configured to work with the App_Data folder specifically.

~:Bin folder - Contains compiled assemblies (.dll files), for code that you want to reference in your application, as in earlier versions of Visual Studio. Any classes represented by code in the Bin folder are automatically referenced in your Web site.

~:App_LocalResources folder - Contains .resx files that are bound to a specific page. You can define multiple .resx files for each page, each .resx file representing a different language or language/culture combination.

~:App_GlobalResource folder - Like the App_LocalResources folders, but contains .resx files that are not bound to a specific page. Resource values in .resx files in the App_GlobalResource folders can be accessed programmatically from application code.

~:App_Code folder - Contains source code files. The code is compiled as part of your application and is referenced automatically. The App_Code folder works much like the Bin folder, except that you can put source code in it instead of compiled code. While you are working in Visual Web Developer, the source code in the App_Code folder is compiled dynamically so that IntelliSense can reference any classes defined in the files.

~:App_Themes folder - Contain sub-folders that each defines a specific theme or look and feel for you Web site. Sub-folders consist of a collection of files (such as .skin, .css and image files) that define the appearance of ASP.Net Web pages and controls.

~:App_WebReferences folder - Contains files used to create a reference to a Web service (in the same project or external to the project), including .disco, .xsd, .discomap and .wsdl files.

Note: Special folders can be added to a Web site from the Visual Studio menu system. Typically this involves right-clicking the Web Application project and selecting Add ASP.NET folder.

Special folders in ASP.Net

With the release of ASP.NET 2.0, Microsoft has greatly increased the power of ASP.Net by introducing a suite of new features and functionalities.

ASP.Net defines several special folders. When a new Web site is created the App_Data folder is created by default; it can contain a SQL Server 2005 Express Edition database, another database, or an XML data file that will be used in the Web site.

These folders are also data directories.

~:App_Browsers folder - Contains browser definitions (.browser files) files that ASP.Net uses to identify individual browsers and determine their capabilities. Browser definition files are used to determine the client browser capabilities. These files are often used to help support mobile application.

~:App_Data folder - App_Data folder is used to store file that can be used as database files (.mdf, .mdb and xml files). The user account that is used to run the application (for example, the local ASPNET account) has permissions to read, write, and create files in this folder. Various ASP.NET application features, such as the providers for membership and roles, as well as the Web Site Administration Tool, are configured to work with the App_Data folder specifically.

~:Bin folder - Contains compiled assemblies (.dll files), for code that you want to reference in your application, as in earlier versions of Visual Studio. Any classes represented by code in the Bin folder are automatically referenced in your Web site.

~:App_LocalResources folder - Contains .resx files that are bound to a specific page. You can define multiple .resx files for each page, each .resx file representing a different language or language/culture combination.

~:App_GlobalResource folder - Like the App_LocalResources folders, but contains .resx files that are not bound to a specific page. Resource values in .resx files in the App_GlobalResource folders can be accessed programmatically from application code.

~:App_Code folder - Contains source code files. The code is compiled as part of your application and is referenced automatically. The App_Code folder works much like the Bin folder, except that you can put source code in it instead of compiled code. While you are working in Visual Web Developer, the source code in the App_Code folder is compiled dynamically so that IntelliSense can reference any classes defined in the files.

~:App_Themes folder - Contain sub-folders that each defines a specific theme or look and feel for you Web site. Sub-folders consist of a collection of files (such as .skin, .css and image files) that define the appearance of ASP.Net Web pages and controls.

~:App_WebReferences folder - Contains files used to create a reference to a Web service (in the same project or external to the project), including .disco, .xsd, .discomap and .wsdl files.

Note: Special folders can be added to a Web site from the Visual Studio menu system. Typically this involves right-clicking the Web Application project and selecting Add ASP.NET folder.

Special folders in ASP.Net

With the release of ASP.NET 2.0, Microsoft has greatly increased the power of ASP.Net by introducing a suite of new features and functionalities.

ASP.Net defines several special folders. When a new Web site is created the App_Data folder is created by default; it can contain a SQL Server 2005 Express Edition database, another database, or an XML data file that will be used in the Web site.

These folders are also data directories.

~:App_Browsers folder - Contains browser definitions (.browser files) files that ASP.Net uses to identify individual browsers and determine their capabilities. Browser definition files are used to determine the client browser capabilities. These files are often used to help support mobile application.

~:App_Data folder - App_Data folder is used to store file that can be used as database files (.mdf, .mdb and xml files). The user account that is used to run the application (for example, the local ASPNET account) has permissions to read, write, and create files in this folder. Various ASP.NET application features, such as the providers for membership and roles, as well as the Web Site Administration Tool, are configured to work with the App_Data folder specifically.

~:Bin folder - Contains compiled assemblies (.dll files), for code that you want to reference in your application, as in earlier versions of Visual Studio. Any classes represented by code in the Bin folder are automatically referenced in your Web site.

~:App_LocalResources folder - Contains .resx files that are bound to a specific page. You can define multiple .resx files for each page, each .resx file representing a different language or language/culture combination.

~:App_GlobalResource folder - Like the App_LocalResources folders, but contains .resx files that are not bound to a specific page. Resource values in .resx files in the App_GlobalResource folders can be accessed programmatically from application code.

~:App_Code folder - Contains source code files. The code is compiled as part of your application and is referenced automatically. The App_Code folder works much like the Bin folder, except that you can put source code in it instead of compiled code. While you are working in Visual Web Developer, the source code in the App_Code folder is compiled dynamically so that IntelliSense can reference any classes defined in the files.

~:App_Themes folder - Contain sub-folders that each defines a specific theme or look and feel for you Web site. Sub-folders consist of a collection of files (such as .skin, .css and image files) that define the appearance of ASP.Net Web pages and controls.

~:App_WebReferences folder - Contains files used to create a reference to a Web service (in the same project or external to the project), including .disco, .xsd, .discomap and .wsdl files.

Note: Special folders can be added to a Web site from the Visual Studio menu system. Typically this involves right-clicking the Web Application project and selecting Add ASP.NET folder.

What is Code Replacement in ASP.Net

.NET Framework assemblies are typically compiled and deployed into a Windows DLL-based PE format. When the common language runtime's loader resolves a class implemented within this type of assembly, it calls the Windows LoadLibrary routine on the file (which locks its access on disk), and then maps the appropriate code data into memory for run-time execution. Once loaded, the DLL file will remain locked on disk until the application domain referencing it is either torn down or manually recycled.

Although ASP.NET cannot prevent the common language runtime from locking a loaded assembly DLL on disk, it can support you by ensuring that the physical DLLs in a Web application's private assembly cache are never actually loaded by the runtime. Instead, shadow copies of the assembly DLLs are made immediately prior to their use. These shadow assemblies--not the original files--are then locked and loaded by the runtime.

Because the original assembly files always remain unlocked, you are free to delete, replace, or rename them without cycling the Web server or having to use a registration utility. FTP and similar methods work just fine. ASP.NET maintains an active list of all assemblies loaded within a particular application's application domain and uses file-change monitoring code to watch for any updates to the original files.

What is Code Replacement in ASP.Net

.NET Framework assemblies are typically compiled and deployed into a Windows DLL-based PE format. When the common language runtime's loader resolves a class implemented within this type of assembly, it calls the Windows LoadLibrary routine on the file (which locks its access on disk), and then maps the appropriate code data into memory for run-time execution. Once loaded, the DLL file will remain locked on disk until the application domain referencing it is either torn down or manually recycled.

Although ASP.NET cannot prevent the common language runtime from locking a loaded assembly DLL on disk, it can support you by ensuring that the physical DLLs in a Web application's private assembly cache are never actually loaded by the runtime. Instead, shadow copies of the assembly DLLs are made immediately prior to their use. These shadow assemblies--not the original files--are then locked and loaded by the runtime.

Because the original assembly files always remain unlocked, you are free to delete, replace, or rename them without cycling the Web server or having to use a registration utility. FTP and similar methods work just fine. ASP.NET maintains an active list of all assemblies loaded within a particular application's application domain and uses file-change monitoring code to watch for any updates to the original files.

By default the member of the interface are public and abstract. true or false?

True

By default the member of the interface are public and abstract. true or false?

True

By default the member of the interface are public and abstract. true or false?

True

By default the member of the interface are public and abstract. true or false?

True

By default the member of the interface are public and abstract. true or false?

True

By default the member of the interface are public and abstract. true or false?

True

In how many ways you can create new copies of an existing string in C#?

There are two ways to create new copies of an existing string in C#:
1. Using overloaded = operator like - string s2 = s1;
2. Using the static Copy method like - string s2 = string.Copy(s1);

In how many ways you can compare two strings in C# using overloaded methods and operators?

There are three ways:
1. Overloaded Compare() method
2. Overloaded Equal() method
3. Overloaded == operator.

In how many ways you can create new copies of an existing string in C#?

There are two ways to create new copies of an existing string in C#:
1. Using overloaded = operator like - string s2 = s1;
2. Using the static Copy method like - string s2 = string.Copy(s1);

In how many ways you can compare two strings in C# using overloaded methods and operators?

There are three ways:
1. Overloaded Compare() method
2. Overloaded Equal() method
3. Overloaded == operator.

What is BOXING and UNBOXING in C#?

BOXING in C# is the conversion of a VALUE type on stack to a OBJECT type on the heap. Vice-versa the conversion from an OBJECT type back to a VALUE type is known as UNBOXING and it requires type casting.

What is BOXING and UNBOXING in C#?

BOXING in C# is the conversion of a VALUE type on stack to a OBJECT type on the heap. Vice-versa the conversion from an OBJECT type back to a VALUE type is known as UNBOXING and it requires type casting.

What are the characteristics of C#?

C# is designed for both computing and communication is characterized by several key features. It is -
1. Simple
2. Consitent
3. Modern
4. Object-oriented
5. Type-safe
6. Versionable
7. Compatible
8. Interoprable and
9. Flexible

What are the characteristics of C#?

C# is designed for both computing and communication is characterized by several key features. It is -
1. Simple
2. Consitent
3. Modern
4. Object-oriented
5. Type-safe
6. Versionable
7. Compatible
8. Interoprable and
9. Flexible

What is ASP.Net?

ASP.Net is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
1. ASP.Net is a Microsoft Technology
2. ASP stands for Active Server Pages
3.ASP.Net is a program that runs inside IIS
4.IIS (Internet Information Services) is Microsofts Internet server

What is C# (C-Sharp)?

C# is a new language created by Microsoft and submitted to the ECMA for standardization. According Microsoft "C# is a modern, object-oriented language that enables programmers to quickly build a wide range of applications for the new Microsoft .Net platform, which provides tools and services that fully exploit both computing and communications."

What is ASP.Net?

ASP.Net is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.
1. ASP.Net is a Microsoft Technology
2. ASP stands for Active Server Pages
3.ASP.Net is a program that runs inside IIS
4.IIS (Internet Information Services) is Microsofts Internet server

What is C# (C-Sharp)?

C# is a new language created by Microsoft and submitted to the ECMA for standardization. According Microsoft "C# is a modern, object-oriented language that enables programmers to quickly build a wide range of applications for the new Microsoft .Net platform, which provides tools and services that fully exploit both computing and communications."

Can the action attribute of a server side &lt form &gt tag be set to a value and if not how can you possibly pass data to another page?

No, You have to use Server.Transfer to pass the data to another page.

Name some of the languages ASP.Net does support?

Some of the languages that are supported by ASP.Net:
1. Visual Basic.Net
2. Visual C#
3. Visual C++

Can the action attribute of a server side &lt form &gt tag be set to a value and if not how can you possibly pass data to another page?

No, You have to use Server.Transfer to pass the data to another page.

Name some of the languages ASP.Net does support?

Some of the languages that are supported by ASP.Net:
1. Visual Basic.Net
2. Visual C#
3. Visual C++

What is the .Net framework?

.Net framework is the technology on which .Net applications are developed and deployed. The framework consist of three main components -
1. CLR (Comman Langauge Runtime)
2. Unified Classes (Framework Base Classes)
3. User and Program Interface (ASP.Net, Winforms)

What is a runtime host in ASP.Net?

.Net framework supports different type of applications like Web, windows, console etc,. Each type of application needs a runtime host to start it. This runtime host loads the runtime into a process, creates the application with in the process and loads the application code into the process. Runtime hosts included in .Net framework are
ASP.Net: It loads the runtime that can handle a web request into the process. ASP.NET also creates an application domain for each Web application that will run on a Web server.

Microsoft Internet Explorer: It creates an application domain to run managed controls.
Shell executables: When ever a runtime executable is launched from the shell, this executable invokes the corresponding runtime host.

What is a runtime host in ASP.Net?

.Net framework supports different type of applications like Web, windows, console etc,. Each type of application needs a runtime host to start it. This runtime host loads the runtime into a process, creates the application with in the process and loads the application code into the process. Runtime hosts included in .Net framework are
ASP.Net: It loads the runtime that can handle a web request into the process. ASP.NET also creates an application domain for each Web application that will run on a Web server.

Microsoft Internet Explorer: It creates an application domain to run managed controls.
Shell executables: When ever a runtime executable is launched from the shell, this executable invokes the corresponding runtime host.

What is the .Net framework?

.Net framework is the technology on which .Net applications are developed and deployed. The framework consist of three main components -
1. CLR (Comman Langauge Runtime)
2. Unified Classes (Framework Base Classes)
3. User and Program Interface (ASP.Net, Winforms)

Which service in the CLR allocates the memory on the managed heap for an object in ASP.Net?

Code manager.

What is the global assembly cache (GAC)?

GAC is a machine-wide cache of assemblies that allows .Net applications to share libraries. GAC solves the problems associated with dll (DLL Hell).

What are assemblies?

An Assembly is single deployable unit that contains all the information about the implementation of the classes, structures, interfaces and are similar to the DLL files. Both have the reusable pieces of code in the form of classes and functions. DLL needs to be registered but assemblies have its own METADATA.

An assembly stores all the information about itself. This is called METADATA and includes the name and version number of the assembly, security information, information about the dependencies and list of files that constitute the assembly.

Namespaces are also stored in the assemblies. In the .Net framework, applications are deployed in the form of assemblies.

What is the global assembly cache (GAC)?

GAC is a machine-wide cache of assemblies that allows .Net applications to share libraries. GAC solves the problems associated with dll (DLL Hell).

Which service in the CLR allocates the memory on the managed heap for an object in ASP.Net?

Code manager.

What are assemblies?

An Assembly is single deployable unit that contains all the information about the implementation of the classes, structures, interfaces and are similar to the DLL files. Both have the reusable pieces of code in the form of classes and functions. DLL needs to be registered but assemblies have its own METADATA.

An assembly stores all the information about itself. This is called METADATA and includes the name and version number of the assembly, security information, information about the dependencies and list of files that constitute the assembly.

Namespaces are also stored in the assemblies. In the .Net framework, applications are deployed in the form of assemblies.

How do you debug an ASP.Net Web application?

Attach the aspnet_wp.exe process to the DbgClr debugger.

How does ASP.Net page works?

1. When a browser requests an HTML file, the server returns the file
2. When a browser requests an ASP.Net file, IIS passes the request to the ASP.Net engine on the server
3. The ASP.Net engine reads the file, line by line, and executes the scripts in the file
4. Finally, the ASP.Net file is returned to the browser as plain HTML.

How does ASP.Net page works?

1. When a browser requests an HTML file, the server returns the file
2. When a browser requests an ASP.Net file, IIS passes the request to the ASP.Net engine on the server
3. The ASP.Net engine reads the file, line by line, and executes the scripts in the file
4. Finally, the ASP.Net file is returned to the browser as plain HTML.

How do you debug an ASP.Net Web application?

Attach the aspnet_wp.exe process to the DbgClr debugger.

What is the default ConnectionTimeOut to wait for a connection to open in ASP.Net?

The default value is 15 seconds.

What is the default ConnectionTimeOut to wait for a connection to open in ASP.Net?

The default value is 15 seconds.

How To Find Number of Days between two Dates in C# Asp.Net?

To calculate the number of days between two dates in Asp.Net using C#, use the below piece of code.
TimeSpan timespan = Convert.ToDateTime("2009-12-31").Subtract(Convert.ToDateTime("2009-01-01"));
Response.Write(timespan.Days+1);

Here we use Subtract method to find the difference between two dates. Usually the Subtract method return a value that is one less than the correct value. So to the Timespan object Days property we can add 1 to get the exact number of days.

How To Find Number of Days between two Dates in C# Asp.Net?

To calculate the number of days between two dates in Asp.Net using C#, use the below piece of code.
TimeSpan timespan = Convert.ToDateTime("2009-12-31").Subtract(Convert.ToDateTime("2009-01-01"));
Response.Write(timespan.Days+1);

Here we use Subtract method to find the difference between two dates. Usually the Subtract method return a value that is one less than the correct value. So to the Timespan object Days property we can add 1 to get the exact number of days.

Session State Management Using SQL Server in ASP.NET

Web applications are by nature stateless. Statelessness is both an advantage and a disadvantage. When resources are not being consumed by maintaining connections and state, scalability is tremendously improved. But the lack of state reduces functionality severely. ECommerce applications require state to be maintained as the user navigates from page to page. ASP.NET’s Session object makes it easy for developers to maintain state in a Web application. State can be maintained in-process, in a session state server, or in SQL Server.

In-process state management is the ASP.NET default, and it offers the fastest response time, but does not work in a Web farm. Consequently, it is not practical in high capacity Web applications requiring the load to be spread over multiple servers. A dedicated session state server is shared by all servers in a Web farm, so it provides scalability of the Session objects across all Web servers. It cannot store state persistently. If a dedicated session state server goes down for any reason, all session state data is lost. SQL Server is another alternative for storing session state for all of the servers in a Web farm. Since SQL Server is a database, there is a popular misconception that ASP.NET session state maintained in SQL Server is stored persistently. By default, it is not. If the SQL Server is stopped, the session state data is lost. By making a few simple changes, state can be stored persistently. It is important to understand that persistent is not the same thing as permanent. ASP.NET places a time limit (timeout in web.config) on how long a session’s state is maintained. If the SQL Server is configured to store state persistently and it is down for longer than the ASP.NET session timeout interval, the session state data is lost.

Configuring ASP.NET Session State Management
Use the sessionState section of the web.config file to configure an ASP.NET Web application to use a SQL Server for session state management. The session state timeout interval is specified by using the timeout parameter.

By default ASP .NET uses cookies to identify which requests
belong to a particular session.
If cookies are not available, a session can be tracked by
adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
–>
_ mode="SQLServer"
_ stateConnectionString="tcpip=127.0.0.1:42424″
_ sqlConnectionString="data source=127.0.0.1; integrated security=true"
_ cookieless="false"
_ timeout="20″
/>

Configure the SQL Server to store Session objects by running a script to create the ASPState database. The .NET Framework provides a state database configuration script in %SYSTEMROOT%\Microsoft.NET\Framework\v1.0.3705\InstallSqlState.sql. If you open the file, you will see a statement to create a database called ASPState. This probably adds to the confusion about state being persistent. The ASPState database contains stored procedures that create tables in tempdb. The tables in tempdb are where session state is actually stored. Thus, when the SQL Server is shutdown, all session state is lost. This raises an important question: If the SQL Server is never shutdown, will tempdb eventually become 100 percent full and run out of space? Recall that ASP.NET connections automatically time out and their resources are freed up after the timeout duration is exceeded. The InstallSqlState.sql script creates a job called ASPState_Job_DeleteExpiredSessions to delete expired sessions from tempdb. Recall that ASP.NET does not keep session resources alive indefinitely. To support this feature when a SQL Server is used to maintain state, the SQL Server Agent must be running so that the expired session deletion job runs as needed. By default, the job is scheduled to run every minute. It deletes session state rows with an Expires value less than the current time. The account under which the SQL Server Agent runs must have the privilege to execute the DeleteExpiredSessions stored procedure.

ASPState database scripts come in pairs. InstallSqlState.sql creates the database and supporting objects. UninstallSqlState.sql drops the database and all supporting objects (e.g., the job to delete expired sessions). You cannot drop a database if it is in use, so if the UninstallSqlState.sql script fails with this error message:

Server: Msg 3702, Level 16, State 4, Line 4
Cannot drop the database ‘ASPState’ because it is currently in use.

Microsoft Knowledge Base article 311209 says to stop the Web server service to overcome this error. An “uninstallation” failure can still occur even if the Web server service is stopped. Additionally, you might not want to stop the Web server service because that will cause all Web applications on the server to stop. Instead, use the SQL Server Enterprise Manager. Find the processes accessing the ASPState database and delete them. If users are still accessing the application and causing new processes to be created faster than you can delete them, go to the IIS console and select the Properties for the Web application. On the Directory tab, click the Remove button. This will prevent access to the Web application and allow you to kill any remaining processes accessing the ASPState database. Once the processes are gone, uninstallation should completely successfully. Be sure to go back to the IIS console and click the Create button to restore the Web application to normal working order if you previously clicked the Remove button.

Version 1.0 of the .NET Framework does not provide a script for creating an ASPState database that maintains state persistently. However, Microsoft Knowledge Base article 311209 does provide a link for downloading InstallPersistentSqlState.sql and UninstallPersistentSqlState.sql. The InstallPersistentSqlState.sql script causes the session state data to be stored in permanent tables in ASPState instead of temporary tables in tempdb.

The .NET Framework provides both InstallPersistentSqlState.sql and InstallSqlState.sql. The Framework scripts are found in the %SYSTEMROOT%\Microsoft.NET\Framework\v1.1.4322 folder. Although the 1.0 and 1.1 versions of InstallPersistentSqlState.sql accomplish the same thing, they are different. For SQL Server 2000 and above, the 1.1 version creates the ASPState stored procedures using GETUTCDATE instead of GETDATE. The 1.0 version always uses GETDATE. You can use the Framework version 1.1 script to create a database for an application using the Framework version 1.0.

If you specify integrated security in the web.config file, you will have to create a server login for the ASPNET user and then make the login a user in the ASPState database. You will also have to grant permissions to the ASPNET user to use database objects. If you do not store state persistently, the ASPNET user must be granted permissions to use state management objects in tempdb. The prudent approach is to grant no more permissions than are absolutely necessary. Here are the permissions I granted after executing the Version 1.0 InstallSqlState.sql script:

USE masterGOEXECUTE sp_grantlogin [DBAZINE\ASPNET]GO USE ASPState GO EXECUTE sp_grantdbaccess [DBAZINE\ASPNET] GRANT EXECUTE on TempGetAppId to [DBAZINE\ASPNET] GRANT EXECUTE on TempGetStateItemExclusive to [DBAZINE\ASPNET] GRANT EXECUTE on TempInsertStateItemShort to [DBAZINE\ASPNET] GO USE tempdb — remove this if using persistent state GO — remove this if using persistent state EXECUTE sp_grantdbaccess [DBAZINE\ASPNET] — remove this if persistent state GRANT SELECT on ASPStateTempApplications to [DBAZINE\ASPNET] GRANT INSERT on ASPStateTempApplications to [DBAZINE\ASPNET] GRANT SELECT on ASPStateTempSessions to [DBAZINE\ASPNET] GRANT INSERT on ASPStateTempSessions to [DBAZINE\ASPNET] GRANT UPDATE on ASPStateTempSessions to [DBAZINE\ASPNET] GO

If you use the InstallPersistentSqlState.sql, remove the three lines as indicated above.

Consider the grants shown above as a starting point for creating your own script appropriate for your environment.

Conclusion
ASP.NET offers two simple solutions to session state management in a Web farm. Only SQL Server offers persistent state management. A dedicated session state server does not offer persistent state management, but does not require the creation of a database (one more thing for the DBA to administer). The value of persistent state has to be weighed carefully. Maintaining session state persistently is useful only if the SQL Server can be brought back up within the session state timeout specified in the web.config. For those situations where using a SQL Server as a state server makes sense, ASP.NET makes it easy.

Session State Management Using SQL Server in ASP.NET

Web applications are by nature stateless. Statelessness is both an advantage and a disadvantage. When resources are not being consumed by maintaining connections and state, scalability is tremendously improved. But the lack of state reduces functionality severely. ECommerce applications require state to be maintained as the user navigates from page to page. ASP.NET’s Session object makes it easy for developers to maintain state in a Web application. State can be maintained in-process, in a session state server, or in SQL Server.

In-process state management is the ASP.NET default, and it offers the fastest response time, but does not work in a Web farm. Consequently, it is not practical in high capacity Web applications requiring the load to be spread over multiple servers. A dedicated session state server is shared by all servers in a Web farm, so it provides scalability of the Session objects across all Web servers. It cannot store state persistently. If a dedicated session state server goes down for any reason, all session state data is lost. SQL Server is another alternative for storing session state for all of the servers in a Web farm. Since SQL Server is a database, there is a popular misconception that ASP.NET session state maintained in SQL Server is stored persistently. By default, it is not. If the SQL Server is stopped, the session state data is lost. By making a few simple changes, state can be stored persistently. It is important to understand that persistent is not the same thing as permanent. ASP.NET places a time limit (timeout in web.config) on how long a session’s state is maintained. If the SQL Server is configured to store state persistently and it is down for longer than the ASP.NET session timeout interval, the session state data is lost.

Configuring ASP.NET Session State Management
Use the sessionState section of the web.config file to configure an ASP.NET Web application to use a SQL Server for session state management. The session state timeout interval is specified by using the timeout parameter.

By default ASP .NET uses cookies to identify which requests
belong to a particular session.
If cookies are not available, a session can be tracked by
adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
–>
_ mode="SQLServer"
_ stateConnectionString="tcpip=127.0.0.1:42424″
_ sqlConnectionString="data source=127.0.0.1; integrated security=true"
_ cookieless="false"
_ timeout="20″
/>

Configure the SQL Server to store Session objects by running a script to create the ASPState database. The .NET Framework provides a state database configuration script in %SYSTEMROOT%\Microsoft.NET\Framework\v1.0.3705\InstallSqlState.sql. If you open the file, you will see a statement to create a database called ASPState. This probably adds to the confusion about state being persistent. The ASPState database contains stored procedures that create tables in tempdb. The tables in tempdb are where session state is actually stored. Thus, when the SQL Server is shutdown, all session state is lost. This raises an important question: If the SQL Server is never shutdown, will tempdb eventually become 100 percent full and run out of space? Recall that ASP.NET connections automatically time out and their resources are freed up after the timeout duration is exceeded. The InstallSqlState.sql script creates a job called ASPState_Job_DeleteExpiredSessions to delete expired sessions from tempdb. Recall that ASP.NET does not keep session resources alive indefinitely. To support this feature when a SQL Server is used to maintain state, the SQL Server Agent must be running so that the expired session deletion job runs as needed. By default, the job is scheduled to run every minute. It deletes session state rows with an Expires value less than the current time. The account under which the SQL Server Agent runs must have the privilege to execute the DeleteExpiredSessions stored procedure.

ASPState database scripts come in pairs. InstallSqlState.sql creates the database and supporting objects. UninstallSqlState.sql drops the database and all supporting objects (e.g., the job to delete expired sessions). You cannot drop a database if it is in use, so if the UninstallSqlState.sql script fails with this error message:

Server: Msg 3702, Level 16, State 4, Line 4
Cannot drop the database ‘ASPState’ because it is currently in use.

Microsoft Knowledge Base article 311209 says to stop the Web server service to overcome this error. An “uninstallation” failure can still occur even if the Web server service is stopped. Additionally, you might not want to stop the Web server service because that will cause all Web applications on the server to stop. Instead, use the SQL Server Enterprise Manager. Find the processes accessing the ASPState database and delete them. If users are still accessing the application and causing new processes to be created faster than you can delete them, go to the IIS console and select the Properties for the Web application. On the Directory tab, click the Remove button. This will prevent access to the Web application and allow you to kill any remaining processes accessing the ASPState database. Once the processes are gone, uninstallation should completely successfully. Be sure to go back to the IIS console and click the Create button to restore the Web application to normal working order if you previously clicked the Remove button.

Version 1.0 of the .NET Framework does not provide a script for creating an ASPState database that maintains state persistently. However, Microsoft Knowledge Base article 311209 does provide a link for downloading InstallPersistentSqlState.sql and UninstallPersistentSqlState.sql. The InstallPersistentSqlState.sql script causes the session state data to be stored in permanent tables in ASPState instead of temporary tables in tempdb.

The .NET Framework provides both InstallPersistentSqlState.sql and InstallSqlState.sql. The Framework scripts are found in the %SYSTEMROOT%\Microsoft.NET\Framework\v1.1.4322 folder. Although the 1.0 and 1.1 versions of InstallPersistentSqlState.sql accomplish the same thing, they are different. For SQL Server 2000 and above, the 1.1 version creates the ASPState stored procedures using GETUTCDATE instead of GETDATE. The 1.0 version always uses GETDATE. You can use the Framework version 1.1 script to create a database for an application using the Framework version 1.0.

If you specify integrated security in the web.config file, you will have to create a server login for the ASPNET user and then make the login a user in the ASPState database. You will also have to grant permissions to the ASPNET user to use database objects. If you do not store state persistently, the ASPNET user must be granted permissions to use state management objects in tempdb. The prudent approach is to grant no more permissions than are absolutely necessary. Here are the permissions I granted after executing the Version 1.0 InstallSqlState.sql script:

USE masterGOEXECUTE sp_grantlogin [DBAZINE\ASPNET]GO USE ASPState GO EXECUTE sp_grantdbaccess [DBAZINE\ASPNET] GRANT EXECUTE on TempGetAppId to [DBAZINE\ASPNET] GRANT EXECUTE on TempGetStateItemExclusive to [DBAZINE\ASPNET] GRANT EXECUTE on TempInsertStateItemShort to [DBAZINE\ASPNET] GO USE tempdb — remove this if using persistent state GO — remove this if using persistent state EXECUTE sp_grantdbaccess [DBAZINE\ASPNET] — remove this if persistent state GRANT SELECT on ASPStateTempApplications to [DBAZINE\ASPNET] GRANT INSERT on ASPStateTempApplications to [DBAZINE\ASPNET] GRANT SELECT on ASPStateTempSessions to [DBAZINE\ASPNET] GRANT INSERT on ASPStateTempSessions to [DBAZINE\ASPNET] GRANT UPDATE on ASPStateTempSessions to [DBAZINE\ASPNET] GO

If you use the InstallPersistentSqlState.sql, remove the three lines as indicated above.

Consider the grants shown above as a starting point for creating your own script appropriate for your environment.

Conclusion
ASP.NET offers two simple solutions to session state management in a Web farm. Only SQL Server offers persistent state management. A dedicated session state server does not offer persistent state management, but does not require the creation of a database (one more thing for the DBA to administer). The value of persistent state has to be weighed carefully. Maintaining session state persistently is useful only if the SQL Server can be brought back up within the session state timeout specified in the web.config. For those situations where using a SQL Server as a state server makes sense, ASP.NET makes it easy.

What is serialization in .NET? What are the ways to control serialization

Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.
• Binary serialization preserves type fidelity, which is useful for preserving the state of an object between different invocations of an application. For example, you can share an object between different applications by serializing it to the clipboard. You can serialize an object to a stream, disk, memory, over the network, and so forth. Remoting uses serialization to pass objects "by value" from one computer or application domain to another.
• XML serialization serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard, it is an attractive choice for sharing data across the Web. SOAP is an open standard, which makes it an attractive choice.
There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.

What is serialization in .NET? What are the ways to control serialization

Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.
• Binary serialization preserves type fidelity, which is useful for preserving the state of an object between different invocations of an application. For example, you can share an object between different applications by serializing it to the clipboard. You can serialize an object to a stream, disk, memory, over the network, and so forth. Remoting uses serialization to pass objects "by value" from one computer or application domain to another.
• XML serialization serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard, it is an attractive choice for sharing data across the Web. SOAP is an open standard, which makes it an attractive choice.
There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.

What is portable executable (PE)

The file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR. The specification for the PE/COFF file formats is available at

What is portable executable (PE)

The file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR. The specification for the PE/COFF file formats is available at

Can I write IL programs directly

Yes.
Following Example is written by Rajesh Rolen:-

.assembly MyAssembly {}
.class MyApp {
.method static void Main() {
.entrypoint
ldstr "Hello, IL!"
call void System.Console::WriteLine(class System.Object)
ret
}
}
Just put this into a file called hello.il, and then run ilasm hello.il. An exe assembly will be generated.

Can I write IL programs directly

Yes.
Following Example is written by Rajesh Rolen:-

.assembly MyAssembly {}
.class MyApp {
.method static void Main() {
.entrypoint
ldstr "Hello, IL!"
call void System.Console::WriteLine(class System.Object)
ret
}
}
Just put this into a file called hello.il, and then run ilasm hello.il. An exe assembly will be generated.

What is MSIL, IL

When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Microsoft intermediate language (MSIL) is a language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.

What is MSIL, IL

When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Microsoft intermediate language (MSIL) is a language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.

What is patindex and charindex in SQL

Patindex: Returns the string position of the first occurrence of pattern
Ex: Select patindex(‘%o%’, ‘Microsoft’)
Ans: 5. Note: % is must
Charindex: Same as patindex but you can specify the string position.
Ex: charindex ( Expression1, Expression2 [ , start_location])

What is patindex and charindex in SQL

Patindex: Returns the string position of the first occurrence of pattern
Ex: Select patindex(‘%o%’, ‘Microsoft’)
Ans: 5. Note: % is must
Charindex: Same as patindex but you can specify the string position.
Ex: charindex ( Expression1, Expression2 [ , start_location])

What is Stuff in SQL server 2000

Specify length of characters and inserts another set of characters at a specified starting point.
Stuff(char_exp, start, length, char_exp[ New ] )
Ex: stuff(‘abcdef’, 2, 3 ‘ijklm’)
Ans: aijklmdef

What is Stuff in SQL server 2000

Specify length of characters and inserts another set of characters at a specified starting point.
Stuff(char_exp, start, length, char_exp[ New ] )
Ex: stuff(‘abcdef’, 2, 3 ‘ijklm’)
Ans: aijklmdef

How do we enable tracing

<%@ Page Trace="true" %>

What exactly happens when ASPX page is requested from Browser


Following are the steps which occur when we request a ASPX page :-
* The browser sends the request to the webserver.let’s assume that the webserver
at the other end is IIS.
* Once IIS receives the request he looks on which engine can serve this request.
When I mean engine means the DLL who can parse this page or compile and
send a response back to browser. Which request to map to is decided by file
extension of the page requested.
Depending on file extension following are some mapping
* .aspx, for ASP.NET Web pages,
* .asmx, for ASP.NET Web services,
* .config, for ASP.NET configuration files,
* .ashx, for custom ASP.NET HTTP handlers,
* .rem, for remoting resources
* Etc
You can also configure the extension mapping to which engine it can route by using the
IIS engine.

Example a ASP page will be sent to old classic ASP.DLL to compile. While .ASPX pages
will be routed to ASP.NET engine for compilation.
* As this book mainly will target ASP.NET we will look in to how ASP.NET
pages that is ASPX pages generation sequence occurs. Once IIS passes the
request to ASP.NET engine page has to go through two section HTTP module
section and HTTP handler section. Both these section have there own work
to be done in order that the page is properly compiled and sent to the IIS.
HTTP modules inspect the incoming request and depending on that they can
change the internal workflow of the request. HTTP handler actually compiles
the page and generates output. If you see your machine.config file you will see
following section of HTTP modules



type="System.Web.Security.WindowsAuthenticationModule" />
type="System.Web.Security.FormsAuthenticationModule" />
type="System.Web.Security.PassportAuthenticationModule" />
type="System.Web.Security.UrlAuthorizationModule" />
type="System.Web.Security.FileAuthorizationModule" />
>

The above mapping shows which functionality is handled by which Namespace. Example
FormsAthuentication is handled by “System.Web.Security.FormsAuthenticationModule”.
If you look at the web.config section HTTP module is where authentication and
authorization happens.
Ok now the HTTP handler is where the actual compilation takes place and the output is
generated.Following is a paste from HTTP handler section of WEB.CONFIG file.







...

* Depending on the File extension handler decides which Namespace will
generate the output. Example all .ASPX extension files will be compiled by
System.Web.UI.PageHandlerFactory
* Once the file is compiled it send back again to the HTTP modules and from
there to IIS and then to the browser.

What exactly happens when ASPX page is requested from Browser


Following are the steps which occur when we request a ASPX page :-
* The browser sends the request to the webserver.let’s assume that the webserver
at the other end is IIS.
* Once IIS receives the request he looks on which engine can serve this request.
When I mean engine means the DLL who can parse this page or compile and
send a response back to browser. Which request to map to is decided by file
extension of the page requested.
Depending on file extension following are some mapping
* .aspx, for ASP.NET Web pages,
* .asmx, for ASP.NET Web services,
* .config, for ASP.NET configuration files,
* .ashx, for custom ASP.NET HTTP handlers,
* .rem, for remoting resources
* Etc
You can also configure the extension mapping to which engine it can route by using the
IIS engine.

Example a ASP page will be sent to old classic ASP.DLL to compile. While .ASPX pages
will be routed to ASP.NET engine for compilation.
* As this book mainly will target ASP.NET we will look in to how ASP.NET
pages that is ASPX pages generation sequence occurs. Once IIS passes the
request to ASP.NET engine page has to go through two section HTTP module
section and HTTP handler section. Both these section have there own work
to be done in order that the page is properly compiled and sent to the IIS.
HTTP modules inspect the incoming request and depending on that they can
change the internal workflow of the request. HTTP handler actually compiles
the page and generates output. If you see your machine.config file you will see
following section of HTTP modules



type="System.Web.Security.WindowsAuthenticationModule" />
type="System.Web.Security.FormsAuthenticationModule" />
type="System.Web.Security.PassportAuthenticationModule" />
type="System.Web.Security.UrlAuthorizationModule" />
type="System.Web.Security.FileAuthorizationModule" />
>

The above mapping shows which functionality is handled by which Namespace. Example
FormsAthuentication is handled by “System.Web.Security.FormsAuthenticationModule”.
If you look at the web.config section HTTP module is where authentication and
authorization happens.
Ok now the HTTP handler is where the actual compilation takes place and the output is
generated.Following is a paste from HTTP handler section of WEB.CONFIG file.







...

* Depending on the File extension handler decides which Namespace will
generate the output. Example all .ASPX extension files will be compiled by
System.Web.UI.PageHandlerFactory
* Once the file is compiled it send back again to the HTTP modules and from
there to IIS and then to the browser.

How do we enable tracing

<%@ Page Trace="true" %>

What is Tracing in ASP.NET

Tracing allows us to view in detail how the code was executed.

What is Tracing in ASP.NET

Tracing allows us to view in detail how the code was executed.

How to disable client side script in validators

Set EnableClientScript to false.

Show the entire validation error message in a message box on the client side

In validation summary set “ShowMessageBox” to true.

Show the entire validation error message in a message box on the client side

In validation summary set “ShowMessageBox” to true.

How to disable client side script in validators

Set EnableClientScript to false.

Which JavaScript file is referenced for validating the validators at the client side

WebUIValidation.js javascript file installed at “aspnet_client” root IIS directory is used to validate the validation controls at the client side

Which JavaScript file is referenced for validating the validators at the client side

WebUIValidation.js javascript file installed at “aspnet_client” root IIS directory is used to validate the validation controls at the client side

How can we check if all the validation control are valid and proper

Using the Page.IsValid() property you can check whether all the validation are done.

If you have client side validation is enabled in your Web page , Does that mean server side code is not run

When client side validation is enabled server emit’s JavaScript code for the custom
validators. But note that does not mean that server side checks on custom validators do
not execute. It does this two time redundant check. As some of the validators do not
support client side scripting.

If you have client side validation is enabled in your Web page , Does that mean server side code is not run

When client side validation is enabled server emit’s JavaScript code for the custom
validators. But note that does not mean that server side checks on custom validators do
not execute. It does this two time redundant check. As some of the validators do not
support client side scripting.

How can we check if all the validation control are valid and proper

Using the Page.IsValid() property you can check whether all the validation are done.

How can we force all the validation control to run

Page.Validate

How can we force all the validation control to run

Page.Validate

Do session use cookies

cookie enabled and cookieless sessions.
By default session uses cookies.

if you do not want to use cookies to store session then add/modify the session section in the web.config to

Do session use cookies

cookie enabled and cookieless sessions.
By default session uses cookies.

if you do not want to use cookies to store session then add/modify the session section in the web.config to

What order in which events of global.asax are triggered

They're triggered in the following order:
Application_BeginRequest
Application_AuthenticateRequest
Application_AuthorizeRequest
Application_ResolveRequestCache
Application_AcquireRequestState
Application_PreRequestHandlerExecute
Application_PreSendRequestHeaders
Application_PreSendRequestContent
<>
Application_PostRequestHandlerExecute
Application_ReleaseRequestState
Application_UpdateRequestCache
Application_EndRequest.

What order in which events of global.asax are triggered

They're triggered in the following order:
Application_BeginRequest
Application_AuthenticateRequest
Application_AuthorizeRequest
Application_ResolveRequestCache
Application_AcquireRequestState
Application_PreRequestHandlerExecute
Application_PreSendRequestHeaders
Application_PreSendRequestContent
<>
Application_PostRequestHandlerExecute
Application_ReleaseRequestState
Application_UpdateRequestCache
Application_EndRequest.

What are major events in GLOBAL.ASAX file

The Global.asax file, which is derived from the HttpApplication class, maintains a pool of HttpApplication objects, and assigns them to applications as needed. The Global.asax file contains the following events:

Application_Init: Fired when an application initializes or is first called. It's invoked for all HttpApplication object instances.

Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.

Application_Error: Fired when an unhandled exception is encountered within the
application.

Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.

Application_End: Fired when the last instance of an HttpApplication class is destroyed. It's fired only once during an application's lifetime.

Application_BeginRequest: Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.

Application_EndRequest: The last event fired for an application request.

Application_PreRequestHandlerExecute: Fired before the ASP.NET page framework
begins executing an event handler like a page or Web service.

Application_PostRequestHandlerExecute: Fired when the ASP.NET page framework is
finished executing an event handler.

Applcation_PreSendRequestHeaders: Fired before the ASP.NET page framework sends
HTTP headers to a requesting client (browser).

Application_PreSendContent: Fired before the ASP.NET page framework sends content
to a requesting client (browser).

Application_AcquireRequestState: Fired when the ASP.NET page framework gets the
current state (Session state) related to the current request.

Application_ReleaseRequestState: Fired when the ASP.NET page framework completes
execution of all event handlers. This results in all state modules to save their current state data.

Application_ResolveRequestCache: Fired when the ASP.NET page framework completes
an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.

Application_UpdateRequestCache: Fired when the ASP.NET page framework completes
handler execution to allow caching modules to store responses to be used to handle
subsequent requests.

Application_AuthenticateRequest: Fired when the security module has established the
current user's identity as valid. At this point, the user's credentials have been validated.

Application_AuthorizeRequest: Fired when the security module has verified that a user
can access resources.

Session_Start: Fired when a new user visits the application Web site.

Session_End: Fired when a user's session times out, ends, or they leave the application Web site.

What are major events in GLOBAL.ASAX file

The Global.asax file, which is derived from the HttpApplication class, maintains a pool of HttpApplication objects, and assigns them to applications as needed. The Global.asax file contains the following events:

Application_Init: Fired when an application initializes or is first called. It's invoked for all HttpApplication object instances.

Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.

Application_Error: Fired when an unhandled exception is encountered within the
application.

Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.

Application_End: Fired when the last instance of an HttpApplication class is destroyed. It's fired only once during an application's lifetime.

Application_BeginRequest: Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.

Application_EndRequest: The last event fired for an application request.

Application_PreRequestHandlerExecute: Fired before the ASP.NET page framework
begins executing an event handler like a page or Web service.

Application_PostRequestHandlerExecute: Fired when the ASP.NET page framework is
finished executing an event handler.

Applcation_PreSendRequestHeaders: Fired before the ASP.NET page framework sends
HTTP headers to a requesting client (browser).

Application_PreSendContent: Fired before the ASP.NET page framework sends content
to a requesting client (browser).

Application_AcquireRequestState: Fired when the ASP.NET page framework gets the
current state (Session state) related to the current request.

Application_ReleaseRequestState: Fired when the ASP.NET page framework completes
execution of all event handlers. This results in all state modules to save their current state data.

Application_ResolveRequestCache: Fired when the ASP.NET page framework completes
an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.

Application_UpdateRequestCache: Fired when the ASP.NET page framework completes
handler execution to allow caching modules to store responses to be used to handle
subsequent requests.

Application_AuthenticateRequest: Fired when the security module has established the
current user's identity as valid. At this point, the user's credentials have been validated.

Application_AuthorizeRequest: Fired when the security module has verified that a user
can access resources.

Session_Start: Fired when a new user visits the application Web site.

Session_End: Fired when a user's session times out, ends, or they leave the application Web site.

Difference between ASP and ASP.NET

ASP.NET new feature supports are as follows :-
Better Language Support
$. New ADO.NET Concepts have been implemented.

$. ASP.NET supports full language (C# , VB.NET,C++) and not simple scripting
like VBSCRIPT..
Better controls than ASP
$. ASP.NET covers large set’s of HTML controls..

$. Better Display grid like Datagrid , Repeater and datalist.Many of the display
grid have paging support.

Controls have event supports

$. All ASP.NET controls support events.

$. Load, Click and Change events handled by code makes coding much simpler
and much better organized.

Compiled Code

The first request for an ASP.NET page on the server will compile the ASP.NET code and
keep a cached copy in memory. The result of this is greatly increased performance.
Better Authentication Support
ASP.NET supports forms-based user authentication, including cookie management and
automatic redirecting of unauthorized logins. (You can still do your custom login page
and custom user checking).
User Accounts and Roles
ASP.NET allows for user accounts and roles, to give each user (with a given role) access
to different server code and executables.
High Scalability
$. Much has been done with ASP.NET to provide greater scalability.

$. Server to server communication has been greatly enhanced, making it possible
to scale an application over several servers. One example of this is the ability
to run XML parsers, XSL transformations and even resource hungry session
objects on other servers.
Easy Configuration

$. Configuration of ASP.NET is done with plain text files.

$. Configuration files can be uploaded or changed while the application is running.
No need to restart the server. No more metabase or registry puzzle.
Easy Deployment
No more server restart to deploy or replace compiled code. ASP.NET simply redirects all new requests to the new code.

Difference between ASP and ASP.NET

ASP.NET new feature supports are as follows :-
Better Language Support
$. New ADO.NET Concepts have been implemented.

$. ASP.NET supports full language (C# , VB.NET,C++) and not simple scripting
like VBSCRIPT..
Better controls than ASP
$. ASP.NET covers large set’s of HTML controls..

$. Better Display grid like Datagrid , Repeater and datalist.Many of the display
grid have paging support.

Controls have event supports

$. All ASP.NET controls support events.

$. Load, Click and Change events handled by code makes coding much simpler
and much better organized.

Compiled Code

The first request for an ASP.NET page on the server will compile the ASP.NET code and
keep a cached copy in memory. The result of this is greatly increased performance.
Better Authentication Support
ASP.NET supports forms-based user authentication, including cookie management and
automatic redirecting of unauthorized logins. (You can still do your custom login page
and custom user checking).
User Accounts and Roles
ASP.NET allows for user accounts and roles, to give each user (with a given role) access
to different server code and executables.
High Scalability
$. Much has been done with ASP.NET to provide greater scalability.

$. Server to server communication has been greatly enhanced, making it possible
to scale an application over several servers. One example of this is the ability
to run XML parsers, XSL transformations and even resource hungry session
objects on other servers.
Easy Configuration

$. Configuration of ASP.NET is done with plain text files.

$. Configuration files can be uploaded or changed while the application is running.
No need to restart the server. No more metabase or registry puzzle.
Easy Deployment
No more server restart to deploy or replace compiled code. ASP.NET simply redirects all new requests to the new code.

How will decide the design consideration to take a Datagrid , datalist or repeater

Many make a blind choice of choosing datagrid directly , but that's not the right way.
Datagrid provides ability to allow the end-user to sort, page, and edit its data.But it
comes at a cost of speed.Second the display format is simple that is in row and columns.
Real life scenarios can be more demanding that With its templates, the DataList provides more control over the look and feel of the displayed data than the DataGrid.It offers better performance than datagrid Repeater control allows for complete and total control. With the Repeater, the only HTML emitted are the values of the databinding statements in the templates along with the HTML markup specified in the templates—no "extra" HTML is emitted, as with the DataGrid and DataList. By requiring the developer to specify the complete generated HTML markup, the Repeater often requires the longest development time.But repeater does not provide editing features like datagrid so everything has to be coded by programmer . However, the Repeater does boast the best performance of the three data Web controls.
Repeater is fastest followed by Datalist and finally datagrid.

How will decide the design consideration to take a Datagrid , datalist or repeater

Many make a blind choice of choosing datagrid directly , but that's not the right way.
Datagrid provides ability to allow the end-user to sort, page, and edit its data.But it
comes at a cost of speed.Second the display format is simple that is in row and columns.
Real life scenarios can be more demanding that With its templates, the DataList provides more control over the look and feel of the displayed data than the DataGrid.It offers better performance than datagrid Repeater control allows for complete and total control. With the Repeater, the only HTML emitted are the values of the databinding statements in the templates along with the HTML markup specified in the templates—no "extra" HTML is emitted, as with the DataGrid and DataList. By requiring the developer to specify the complete generated HTML markup, the Repeater often requires the longest development time.But repeater does not provide editing features like datagrid so everything has to be coded by programmer . However, the Repeater does boast the best performance of the three data Web controls.
Repeater is fastest followed by Datalist and finally datagrid.

What’s the method to customize columns in DataGrid

Use the template column.

How can we format data inside DataGrid

Use the DataFormatString property

How can we format data inside DataGrid

Use the DataFormatString property

What’s the method to customize columns in DataGrid

Use the template column.

Difference between Datagrid , Datalist and repeater From performance point of view

Repeater is fastest followed by Datalist and finally datagrid.

Difference between Datagrid , Datalist and repeater From performance point of view

Repeater is fastest followed by Datalist and finally datagrid.

What’s difference between Datagrid , Datalist and repeater

A Datagrid, Datalist and Repeater are all ASP.NET data Web controls.
They have many things in common like DataSource Property , DataBind Method
ItemDataBound and ItemCreated.
When you assign the DataSource Property of a Datagrid to a DataSet then each DataRow
present in the DataRow Collection of DataTable is assigned to a corresponding
DataGridItem and this is same for the rest of the two controls also.But The HTML code
generated for a Datagrid has an HTML TABLE element created for the particular
DataRow and its a Table form representation with Columns and Rows.
For a Datalist its an Array of Rows and based on the Template Selected and the
RepeatColumn Property value We can specify how many DataSource records should
appear per HTML < table > row. In short in datagrid we have one record per row, but in datalist we can have five or six rows per row.
For a Repeater Control,The Datarecords to be displayed depends upon the Templates
specified and the only HTML generated is the due to the Templates.
In addition to these , Datagrid has a in-built support for Sort,Filter and paging the Data ,which is not possible when using a DataList and for a Repeater Control we would require to write an explicit code to do paging.

What’s difference between Datagrid , Datalist and repeater

A Datagrid, Datalist and Repeater are all ASP.NET data Web controls.
They have many things in common like DataSource Property , DataBind Method
ItemDataBound and ItemCreated.
When you assign the DataSource Property of a Datagrid to a DataSet then each DataRow
present in the DataRow Collection of DataTable is assigned to a corresponding
DataGridItem and this is same for the rest of the two controls also.But The HTML code
generated for a Datagrid has an HTML TABLE element created for the particular
DataRow and its a Table form representation with Columns and Rows.
For a Datalist its an Array of Rows and based on the Template Selected and the
RepeatColumn Property value We can specify how many DataSource records should
appear per HTML < table > row. In short in datagrid we have one record per row, but in datalist we can have five or six rows per row.
For a Repeater Control,The Datarecords to be displayed depends upon the Templates
specified and the only HTML generated is the due to the Templates.
In addition to these , Datagrid has a in-built support for Sort,Filter and paging the Data ,which is not possible when using a DataList and for a Repeater Control we would require to write an explicit code to do paging.

.NET framework overview 1

Has own class libraries. System is the main namespace and all other namespaces are subsets of this.

It has CLR(Common language runtime, Common type system, common language specification)

All the types are part of CTS and Object is the base class for all the types.

If a language said to be .net complaint, it should be compatible with CTS and CLS.

All the code compiled into an intermediate language by the .Net language compiler, which is nothing but an assembly.

During runtime, JIT of CLR picks the IL code and converts into PE machine code and from there it processes the request.
CTS, CLS, CLR
Garbage Collection
Dispose, finalize, suppress finalize, Idispose interface
Assemblies, Namespace

Assembly is a collection of class/namespaces. An assembly contains Manifest, Metadata, Resource files, IL code
Com interoperability, adding references, web references
Database connectivity and providers
Application Domain

About this blog

Blog Archive

My Blog List

Advertise On This Site

Site Info

Advertise on this Site

To advertise on this site please mail on RajeshRolen@gmail.com

Information Source

About

Pages

Dot Net Academy

Advertis in This Area of Site

Powered by Blogger.

Followers

Blog Archive

Search This Blog