0% found this document useful (0 votes)
26 views13 pages

AWP

The document discusses various ASP.NET controls and concepts like validation controls, events, event handlers, namespaces, assemblies, constructors, properties, methods, delegates, inheritance, and boxing and unboxing. It provides explanations and examples of these topics.

Uploaded by

shrishtishah149
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views13 pages

AWP

The document discusses various ASP.NET controls and concepts like validation controls, events, event handlers, namespaces, assemblies, constructors, properties, methods, delegates, inheritance, and boxing and unboxing. It provides explanations and examples of these topics.

Uploaded by

shrishtishah149
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

AWP

Unit 2

// List box and drop down list


(Learn From pdf answer 1)

// ad rotator control

// Validation control

<asp:CompareValidator ID="cvPasswordMatch" runat="server"


ControlToValidate="txtConfirmPassword" ControlToCompare="txtPassword" Operator="Equal"
Type="String" ErrorMessage="Passwords do not match"></asp:CompareValidator>

(displays a summary of validation errors that occur on a page)


<asp:ValidationSummary ID="valSummary" runat="server"
DisplayMode="BulletList"
ShowMessageBox="true"
ShowSummary="true"
ValidationGroup="Group1"
HeaderText="Validation Summary:"
EnableClientScript="true">
</asp:ValidationSummary>

// Calender control

A Calendar control is a tool used in web development to manage and display dates interactively.
It's often used in applications where date-related information needs to be organized, such as
scheduling or event management systems.

• Features
There are various formats of calender are available you can click on autoformat to choose any
other format.
The control displays a calendar in which users can move to any day in any year.
Clicking on a date highlights it.
You can also customise the highlighting colour for a selected date.
You can customize cells to show details and other informations like appointments or tasks of
that day.

• Properties & descriptions


Caption : Gets or sets the caption for the calendar control.
CaptionAlign : Gets or sets the alignment for the caption.
CellPadding : Gets or sets the number of spaces between the data and the cell border.
CellSpacing : Gets or sets the space between cells.
SelectedDate : Gets or sets the selected date.

• Events and description


SelectionChanged : It is raised when a user select a day, a week or an entire month.
DayRender : It is raised when each data cell of the calendar control is rendered.
VisibleMonthChanged : It is raised when user changes a month.

// Event handler

(Read and write on own)


In web programming, an event is like a trigger that occurs during user interaction or system
notifications. For example, clicking a mouse button, pressing a key, or moving the mouse can be
events.

Now, in ASP.NET web programming, you often want your web page to respond to these events.
This is where event handlers come in. An event handler is a piece of code that gets executed in
response to a specific event.

To add an event handler in ASP.NET using Visual Studio, you have three ways:

1. **Type it in manually:**
- You write the code for the event handler directly in your C# code file. Specify the necessary
parameters for the event.

2. **Double-click a control in design view:**


- If you're using Visual Studio's design view, you can double-click on a control (like a button) to
automatically generate an event handler for that control's default event.

3. **Choose the event from the Properties window:**


- Select a control, go to the Properties window, and find the lightning bolt icon. Clicking it will
show a list of events for that control. Double-clicking next to the event you want will make Visual
Studio generate the event handler code for you.

So, in a nutshell, an event is something that happens (like a click), and an event handler is the
code that responds to that happening. You can add event handlers by typing them manually,
double-clicking controls, or selecting events from the Properties window.

// AutoPostBack is different from isPostBack

AutoPostBack is use to reload the page automatically when a certain event is triggered

isPostBack is use to identify whether the page is loaded for the first time or it is reload it will
return Boolean value.

See program↓ for isPostBack


https://chat.openai.com/c/12f45685-c12a-4cfd-913c-492d87f68376

// list controls
( Read and write on OWN )
( Shikshak Pdf answer 19 )

Lists are generally used when a number of options you want to provide to the user

// Checkbox,dropdownlist, textbox, menu


( Shikshak Pdf Answer 14 )

Unit 1

// Foreach loop

The foreach loop is a control flow statement used to iterate over elements in a collection, such
as arrays or lists.

Syntax :
https://www.geeksforgeeks.org/c-sharp-foreach-loop/amp/

Explain this Syntax than give example

(Example* in practical)

// Abstract Class And Interface

» Abstract Class

• An abstract class can have access modifiers on its members.


• An abstract class can have abstract method as well as concrete method.
• a class cannot inherit multiple classes at the same time.
• Abstract class can contain feilds.
• Abstract class is defined using keyword 'abstract'.
• ex, public abstract class class_name
{
public abstract void method_name();
public void common_method()
{
}
}

» Interface

• Interface cannot have access modifiers on its members they're bydefault public
• All the methods in Interface are abstract.
• A class can inherit multiple interfaces at the same time.
• An Interface cannot contain feilds.
• An interface is defined using a keyword 'interface'
• ex, public interface interface_name
{
void method_name();
}
// Namespace & About System Namespace

The Namespace is a keyword, used to declare a scope that contains a set of related objects.

System Namespace
• Explain in own
(like widely used, most common etc)
• Why we use
• Some common classes in System Namespace
( Console, String, Math, DateTime, IO )
• syntax
• Simple Console.WriteLine example

// Assembly & Private And Public Assembly

An Assembly is a collection of code files that are compiled into an executable (.exe) or a
Dynamic Link Library (.dll).

» Public Assembly
• A public assembly is intended to be shared and used by multiple applications or projects.
• It is placed in Global Assembly Cache (GAC).
• They can be accessed by any application in a system.
• Shared assembly require special configuration and installation.
• They need to be registered with the GAC using 'gacutil.exe'.

» Private Assembly
• A private assembly is intended to be used by a single application or project.
• It is not placed in Global Assembly Cache (GAC).
• They cannot be accessed by other application.
• Private assembly are simple to deploy and use.
• They're automatically loaded by the .NET runtime when the application starts.

// Access Modifiers

( Img* inside folder)

For Reference↓
( https://youtu.be/aAEcoKY wD8I )

NOTE:
• Classes are only internal (bydefault) OR public
• Members are private (bydefault)
• A project is an assembly

// Jagged Array

Jagged array is a array of arrays such that member arrays can be of different sizes.

Syntax & Syntax-Example ↓


https://www.google.com/amp/s/www.geeksforgeeks.org/c-sharp-jagged-arrays/amp/
(explaination in programs jagged array*)

Considering the scenario↓

There are 3 emloyees in a company who have name mark, sam, tom.
Mark have 3 degrees
Sam have 1 degrees
Tom have 2 degrees

// .Net framework architecture

It is a virtual machine that provide a common platform to run an application that was built using
the different language such as C#, C++, VB.NET, etc.

1. Languages
• .NET Compliant languages are programming languages like C#,VB.NET,F# etc that follow the
rules and guidelines set by the Common Language Infrastructure (CLI), Allowing developers to
choose their preferred language for building .NET applications.

2. CLS & CTS


• CLS is Common language Specification And CTS is Common Type System.
• It defines a set of rules that ensure language interoperability within the .NET Framework.

3. Different Projects
• Visual Studio allow us to work on different project like Web Services, Web forms, Windows
forms.

4. Data & XML classes


• Data and XML classes in .NET provide functionality for working with data and XML documents.
• They include classes for database access (ADO.NET) making it easier to work with data.

5. BCL
• BCL is also called as Framework Class Liabrary (FCL).
• The BCL is Base Class Liabrary it is a collection of classes that provide essential
functionalities for .NET applications.
• It includes classes for file I/O, networking, string manipulation, collections, threading, and
more.
• BCL is the core library for common programming tasks.
6. CLR
• CLR is a Common Language Runtime.
• The CLR is the execution engine of the .NET Framework.
• It manages the execution of .NET applications, including memory management, security, and
JIT compilation.
• It ensures that .NET applications run safely and efficiently on Windows operating systems.

(Diagram↓)
https://www.javatpoint.com/vb-net-dot-net-framework-introduction

Note:
• FCL = BCL

// Constructor Types

• Default
• Parameterized
• Copy
• Static
• Private

For More Refer this link↓


( https://www.c-sharpcorner.com/UploadFile/0c1bb2/constructors-and-its-types-in-C-Sharp/ )

// Multiple Inheritance

(Refer interface in program*)


// Property? Get and Set accessors
( Refer = https://youtu.be/iGR425gMKeA )

Properties are the special type of class members that provides a flexible mechanism to read,
write, or compute the value of a private field.

• Read/Write property
A property(function) with both get and set accessors
• Read Only Property
Only get accessor
• Write Only Property
Only set accessor
• Auto Implemented property
Ex, public void func_name{get; set;}

set{name=value;}
get{return this.private_var;}

(See practical folder*)

// Types of method parameter


( Refer = https://youtu.be/7xYSFbUPP0E )

• Value
• Reference
• Out
• Parameter arrays

(Also refer practicals *)

// Delegate and Multicast Delegate

A Delegate is a type-safe function pointer.

Two types↓
SingleCast Delegate: A delegate refers to a single function or method.
MultiCast Delegate: A delegate refers to a multiple functions or methods.
//Boxing and Unboxing

• Boxing is the process of converting a value type to an object reference type.


• Unboxing is the process of converting an object reference type to a value type.

Example↓

static void Main()


{
// Example of boxing
int value = 42;
object boxedValue = value; // Boxing occurs here

// Unboxing
int unboxedValue = (int)boxedValue; // Unboxing occurs here

Console.WriteLine("Original value: " + value);


Console.WriteLine("Boxed value: " + boxedValue);
Console.WriteLine("Unboxed value: " + unboxedValue);
}

//Math Functions

(Refer practical*)

// Type conversion

(Understand but do not prioritise in exam)


(Refer miss notes*)

// Partial class

Partial class break the functionality of a single class into many files. When the application is
compiled, these files are then reassembled into a single class file.

Note↓
• Should have same namespace
• can have different class name
• can have many partial class no limitations
• can have main method in file contain partial class

Example:

File1.cs ↓

namespace PartialClassExample
{
public partial class Employee
{
private string firstName;
private string lastName;

public Employee(string firstName, string lastName)


{
this.firstName = firstName;
this.lastName = lastName;
}
}
}

class Program
{
static void Main()
{
Employee employee = new Employee("John", "Doe");
EmployeeDetails details = new EmployeeDetails();

details.DisplayDetails("HR");
}
}
File2.cs ↓

namespace PartialClassExample
{
public partial class EmployeeDetails
{
public void DisplayDetails(string department)
{
Console.WriteLine($"Name: {firstName} {lastName}, Department: {department}");
}
}
}

Extra↓

// Nullables

int a = null;
int? a = null;

✔️
• These are the value types (int, float, double, bool) can't be null to make it null you need to use
(?).
• String is a class it comes under reference type can be null easily.(class, interface, arrays,
delegates, nullables)

// Static Method
• Can't create reference variable of Static Method
• A static method can be called in 2 ways
1) Method_name(); //in same class
2) Class_Name.Method_Name(); //in other class

// Static class can only have static members in it.

// Instance variable is defined inside a class but outside a method


&
Local variable is defined inside a method or in the parameter part of a method.

// 'this' keyword used for instance variable


// Types of inheritance

• Single Level Inheritance


• Multi Level Inheritance
• Hierarchical Inheritance
• Multiple Inheritance (using interface)

https://www.c-sharpcorner.com/UploadFile/0c1bb2/types-of-inheritance-in-C-Sharp/

// 'sealed' keyword
When we use this keyword while creating class then the class cannot be inherited further.
Eg, " public sealed class A
{
} "

You might also like