Properties and Syntaxes
STANDARD CONTROLS:
Label Control
Button Control
Textbox Control: Textmode, Maxlength
Radiobutton Control: Checked, GroupName
Radiobuttonlist Control
Dropdownlist Control
Checkbox Control: Checked
Checkboxlist Control
Listbox Control
AdRotator: AdvertisementFile, Target
Calendar Control: SelectedDate, SelectedDates
FileUpload Control
Panel Control
VALIDATION CONTROLS:
Required Field Validator
Compare Validator: Control To Compare, Operator, Type
Range Validator: Minimum Value, Maximum Value, Type
Custom Validator: Client Validation Function
RegularExpressionValidator: Validation Expression
Common properties for all webserver controls: ID, Text
Common properties for validation controls: Control To Validate, Error Message
Common properties for the list controls which supports single item selection:
Items, Repeat Direction
2
SelectedItem.Text
SelectedItem.Value or SelectedValue
SelectedIndex
ArrayList alobject = new ArrayList();
alobject.Add(string value);
controlname.Datasource = objectname;
controlname.Databind();
Common properties for the list control that supports multiple item selection:
Items.Count
Items[index].Selected
Items[index].Text
Items[index].Value
Common methods for all the list controls:
Items.Add(string or listitem)
ListItem liobject = new ListItem();
liobject.Text = value1;
liobject.Value = value2;
listcontrolname.Items.Add(liobject);
Items.RemoveAt(listIndex);
Items.Clear();
Controlname.Attributes.Add(“eventName”, “[return]functionName([arg Value(s)])”;
Example to generate a message box:
btnClick.Attributes.Add(“onClick”,”alert(‘Welcome to .Net’)”)
To rise a confirmation box:
btnclick.Attributes.Add(“onClick”,”return confirm(‘Prompt Message’)”);
3
Structure of Advertisement File:
<Advertisements>
<Ad>
<ImageUrl>…</ImageUrl>
<NavigateUrl>…</NavigateUrl>
<AlternateText>…</AlternateText>
<Impressions>…</Impressions>
</Ad>
<Ad>
….
….
</Ad>
</Advertisements>
(TableCell)e.cell
(CalendarDay)e.day
Literal Control: Used to add a string as a control to any other standard control.
LiteralControl lcobject = new LiteralControl(string value);
In order to add a control to any other control:
ControlName.Controls.Add(Control or object);
In order to clear the controls present within other controls:
ControlName.Controls.Clear();
4
ADO.NET
Connection:
xxxConnection objectName = new xxxConnection(connectionString);
Where xxx in above syntax can be either Sql, Oracle, Oledb or ODBC.
Connection string to connect to Sql server database:
provider = sqloledb.1; user id = sa; password = ; datasouce = server; database = DBName
Connection string to connect to Oracle database:
provider = oraoledb.oracle; user id = scott; password = tiger[; datasouce = server]
(Underlined is optional. If client and server same no need optional).
If Oracle 8i then provider = msdaora.1; …
Note: Whenever Sqlconnection class is used to connect Sqlserver and Oracle connection
class is used to connect Oracle database then provider = providername should not be
mentioned within the connection string.
DataAdapter:
xxxDataAdapter objectName = new xxxDataAdapter (select statement, <connectionString or connectionObject>);
Note: Whenever a DataAdapter is defined using the above syntax then select command of
data adapter will be generated (other commands will not be generated).
DataSet: Dataset objectName = new Dataset();
DataView: Dataview objectName = new Dataview(DatasetName.DataTable);
Command: xxxCommand objectName = new xxxCommand ([Sql statement, ConnectionObject or ConnectionString]);
DataReader: xxxDataReader objectName;
CommandBuilder: xxxCommandBuilder objectName = new xxxCommandBuilder(DataAdapterObject);
GridView Control: Page Size,
Pager Settings
Mode: Numeric
PageButtonCount
Position
NextPrevious
NextPageText
PreviousPageNext
Position
5
StyleSheets:
To build styles for the html tags:
tag
{
property: value;
…
}
Syntax to define StyleSheetClass:
.ClassName
{
property:value;
…
}
Syntax to define a style based on Control ID:
#idName
{
property:value;
…
}
LOGIN CONTROLS:
Login: CreateUserUrl,
CreateUserText
PasswordRecoveryUrl,
PasswordRecoveryText,
DestinationPageUrl
CreateUserWizard: ContinueDestinationPageUrl
PasswordRecovery: SuccessPageUrl
MailDefinition
From
Priority
Subject
ChangePassword: ContinueDestinationPageUrl