Search This Blog
Friday, January 24, 2014
What is ASP.NET
ASP.NET is a unified Web development model that includes the services necessary for you to build enterprise-class Web applications.
Etichete:
asp.net
Get file name C# Example
C# > Files > GetFileName
Returns the file name and extension of the specified path string.
Example:
dlg.DefaultExt = ".doc";
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
string filename = dlg.FileName;
filename = System.IO.Path.GetFileName(filename);
}
Returns the file name and extension of the specified path string.
Example:
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Document";dlg.DefaultExt = ".doc";
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
string filename = dlg.FileName;
filename = System.IO.Path.GetFileName(filename);
}
Etichete:
c#
Autosize Control sized based on its text C# CilentSize
C# > Controls > ClientSize
ClientSize gets or sets the height and width of the client area of the control.
Example:
Autosize TextBox width and height based on its text.
C# Code:
Graphics g = control.CreateGraphics();
Size size = g.MeasureString(control.Text, control.Font).ToSize();
control.ClientSize = new Size(size.Width+10 ,size.Height);
g.Dispose();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
AutoSizeControl(textBox1);
}
ClientSize gets or sets the height and width of the client area of the control.
Example:
Autosize TextBox width and height based on its text.
C# Code:
private void AutoSizeControl(Control control)
{Graphics g = control.CreateGraphics();
Size size = g.MeasureString(control.Text, control.Font).ToSize();
control.ClientSize = new Size(size.Width+10 ,size.Height);
g.Dispose();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
AutoSizeControl(textBox1);
}
Etichete:
c#
C# Control Class
C# > Control class
Control is the base class for controls.
Controls are components with visual representation.
Controls are components with visual representation.
Etichete:
c#
Tuesday, January 21, 2014
Int, bigint, smallint, and tinyint SQL Server
SQL Server > Data Types > Int, bigint, smallint, and tinyint
These type are exact number data types and use integer data.
The bigint data type is used when integer values exceed the range.
Example:
Use int type for primary key in a table
These type are exact number data types and use integer data.
The bigint data type is used when integer values exceed the range.
bigint
|
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
|
int
|
-2,147,483,648 to 2,147,483,647
|
smallint
|
-32,768 to 32,767
|
tinyint
|
0 to 255
|
Use int type for primary key in a table
CREATE TABLE [dbo].[Table]
(
[Id] INT NOT NULL PRIMARY KEY
)
|
Etichete:
SQL Server
Decimal and numeric types SQL Server example
SQL Server > Data Types > decimal and numeric
Numeric is functionally equivalent to decimal.
They have fixed precision and scale.
precision: maximum total number of decimal digits (for both left and right)
scale: number of decimal digits that will be stored to the right of the decimal point.
Example:
declare @num numeric(20,5)
set @num = 1333.2
print @num
declare @num1 numeric(20,0)
set @num1 = 1333.2
print @num1
Result:
1333.20000
1333
Numeric is functionally equivalent to decimal.
They have fixed precision and scale.
precision: maximum total number of decimal digits (for both left and right)
scale: number of decimal digits that will be stored to the right of the decimal point.
Example:
declare @num numeric(20,5)
set @num = 1333.2
print @num
declare @num1 numeric(20,0)
set @num1 = 1333.2
print @num1
Result:
1333.20000
1333
Etichete:
SQL Server
RadGrid for ASP.NET AJAX
Telerik > RadGrid
RadGrid for ASP.NET AJAX is a control for data, paging, sorting, filtering and data editing to grouping and displaying hierarchical data.
RadGrid for ASP.NET AJAX is a control for data, paging, sorting, filtering and data editing to grouping and displaying hierarchical data.
Etichete:
Telerik
Subscribe to:
Posts (Atom)