Learn And Development is a kind of blog where some issues has been solved.I gone through those issue and manage myself to solve.I know reader must be benefited if they go through on it.
Tuesday, October 21, 2008
Sitemap
2.Implementing Trigger in SQL Server
3.Conceptual tropic In Asp.Net
4.Showing line numbers in Visual Studio.NET
5.Control sql server through command prompt
6.Use checkboxes in a .NET Repeater
7.Run Function
8.Opening applications in Run
9.Htaccess
10.Dynamic Html
11.Javascript
12.Jquery
Sunday, October 19, 2008
Few Conceptual topic in Asp.Net usingc#
Importent Note:
We have to remember that static member and static method belongs to class rather than to the object of the class i.e we can access a static member or static method by class name.member name or class name.method name.we cant access a static member or static method by creating a object of that class.
Get and Set property in c#
When we using get and set property in c# we use First1 but not the Second1.
While we using Property function we have to remember the following pont
1)Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.
2)Property Statement cannot appear within a method body.
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal value As String)
mName = value
End Set
End Property
Its strongly recomended that we never use () after a poperty name.Because if we use () after property name then it will treat as a function not a property.Thats why we always use First1 not Second1
(Note:Get is use to read a Property and Set is use to write Property)
First1
public string getName
{
get
{
return Name;
}
set
{
Name = value;
}
}
Second1
public string getName()
{
get
{
return Name;
}
set
{
Name = value;
}
}
An example, which uses a set of methods, to access a private data field is shown below.
using System;
class MyClass
{
private int x;
public void SetX(int i)
{
x = i;
}
public int GetX()
{
return x;
}
}
class MyClient
{
public static void Main()
{
MyClass mc = new MyClass();
mc.SetX(10);
int xVal = mc.GetX();
Response.Write(xVal);//Displays 10
}
}
But C# provides a built in mechanism called properties to access private data member
The general form of declaring a property is as follows.
<acces_modifier> <return_type> <property_name>
{
get
{
}
set
{
}
}
Above program can be modifies with a property X as follows.
using System;
class MyClass
{
private int x;
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
}
class MyClient
{
public static void Main()
{
MyClass mc = new MyClass();
mc.X = 10;
int xVal = mc.X;
Response.Write(xVal);//Displays 10
}
}
We have to rember that a property should have at least one accessor either set or get .The set accessor has a free variable available in it called value, which gets created automatically by the compiler. We can't declare any variable with the name value inside the set accessor.
Static Properties
The following program shows a class with a static property.
using System;
class MyClass
{
private static int x;
public static int X
{
get
{
return x;
}
set
{
x = value;
}
}
}
class MyClient
{
public static void Main()
{
MyClass.X = 10;
int xVal = MyClass.X;
Response.Write(xVal);//Displays 10
}
}
Note:Static property can access only other static members of the class. Also static properties are invoking by using the class name.
Properties & Inheritance
The properties of a Base class can be inherited to a Derived class.
using System;
class Base
{
public int x ;
public int X
{
get
{
return x+1;
}
set
{
x =value;
}
}
}
class Derived : Base
{
}
class MyClient
{
public static void Main()
{
Derived d1 = new Derived();
d1.X = 10;
Response.Write(d1.X);//Displays 'Base SET Base GET 11'
}
}
The above program is very straightforward. The inheritance of properties is just like inheritance any other member.
Properties & Polymorphism
A Base class property can be polymorphicaly overridden in a Derived class. But remember that the modifiers like virtual, override etc are using at property level, not at accessor level.
using System;
class Base
{
public virtual int X
{
get
{
Console.Write("Base GET");
return 10;
}
set
{
Console.Write("Base SET");
}
}
}
class Derived : Base
{
public override int X
{
get
{
Console.Write("Derived GET");
return 10;
}
set
{
Console.Write("Derived SET");
}
}
}
class MyClient
{
public static void Main()
{
Base b1 = new Derived();
b1.X = 10;
Response.Write(b1.X);//Displays 'Derived SET Derived GET 10'
}
}
Abstract Properties
A property inside a class can be declared as abstract by using the keyword abstract. Remember that an abstract property in a class carries no code at all. The get/set accessors are simply represented with a semicolon. In the derived class we must implement both set and get assessors.
If the abstract class contains only set accessor, we can implement only set in the derived class.
The following program shows an abstract property in action.
using System;
abstract class Abstract
{
public abstract int X
{
get;
set;
}
}
class Concrete : Abstract
{
public override int X
{
get
{
Response.Write(" GET");
return 10;
}
set
{
Response.Write(" SET");
}
}
}
class MyClient
{
public static void Main()
{
Concrete c1 = new Concrete();
c1.X = 10;
Response.Write(c1.X);//Displays 'SET GET 10'
}
}
The properties are an important features added in language level inside C#. They are very useful in GUI programming. Remember that the compiler actually generates the appropriate getter and setter methods when it parses the C# property syntax.
Friday, October 10, 2008
Showing line numbers in Visual Studio.NET
Just navigate to the menu, choose Tools | Options and expand the Text editor node in the treeview on the left like shown in Figure 1:
Figure 1: The expanded Text Editor part.
In Figure 1 it is showing All languages node or the node of the language that you're interested in and check the Line numbers checkbox. Click the OK button and you have the line numbers appearing in your source view.
Tuesday, August 19, 2008
Control sql server through command prompt
usage: Sqlcmd [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend] [-L[c] list servers[clean output]]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]
[-u unicode output] [-r[0|1] msgs to stderr]
[-i inputfile] [-o outputfile] [-z new password]
[-f <codepage> | i:<codepage>[,o:<codepage>]] [-Z new password and exit]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting]
[-b On error batch abort]
[-v var = "value"...] [-A dedicated admin connection]
[-X[1] disable commands, startup script, environment variables [and exit]]
[-x disable variable substitution]
[-? show syntax summary]
Saturday, June 28, 2008
The RIGHT way to use checkboxes in a .NET Repeater!
Here retrieve checkbox value in case of repeater
public void DoSend(object sender, EventArgs e)
{.
foreach (RepeaterItem i in customerList.Items)
{.
//Retrieve the state of the CheckBox.
CheckBox cb = (CheckBox)i.FindControl("selectUser");.
if (cb.Checked)
{.
//Retrieve the value associated with that CheckBox.
HiddenField hiddenEmail = (HiddenField)i.FindControl("hiddenEmail");.
//Now we can use that value to do whatever we want.
SendWelcomeMessage(hiddenEmail.Value);.
}
}.
}.
Thursday, May 15, 2008
Entry for Run Function
Entry for Run Function
ciadv.msc Manages the Indexing Service.
compmgmt.msc Computer Management Console. It contains a number of the other consoles.
devmgmt.msc Device Manager.
dfrg.msc Disk Defragmenter.
diskmgmt.msc Disk Management.
gpedit.msc Group Policy Editor. Windows XP Professional only.
services.msc Manages the many services involved in Windows and installed software.
Opening applications in Run
calc => Opens calculator.
cmd => Opens command prompt window.
explorer => Opens Windows explorer.
magnify => Screen magnifier accessory.
msconfig => System Configuration Utility.
mshearts => Opens Hearts game.
msinfo32 => System Information applet.
mspaint => Opens graphics accessory Paint.
notepad => Notepad accessory.
regedit => Registry editor.
sol => Opens Classical Solitaire game.