Search this blog
Tuesday, October 26, 2010
Validation Control
Validation Server Control | Description |
---|---|
CompareValidator | Compares the value of one input control to the value of another input control or to a fixed value |
CustomValidator | Allows you to write a method to handle the validation of the value entered |
RangeValidator | Checks that the user enters a value that falls between two values |
RegularExpressionValidator | Ensures that the value of an input control matches a specified pattern |
RequiredFieldValidator | Makes an input control a required field |
ValidationSummary | Displays a report of all validation errors occurred in a Web page |
User control Vs. Custom control
Factors | User control | Custom control |
Deployment | Designed for single-application scenarios Deployed in the source form (.ascx) along with the source code of the application If the same control needs to be used in more than one application, it introduces redundancy and maintenance problems | Designed so that it can be used by more than one application Deployed either in the application's Bin directory or in the global assembly cache Distributed easily and without problems associated with redundancy and maintenance |
Creation | Creation is similar to the way Web Forms pages are created; well-suited for rapid application development (RAD) | Writing involves lots of code because there is no designer support |
Content | A much better choice when you need static content within a fixed layout, for example, when you make headers and footers | More suited for when an application requires dynamic content to be displayed; can be reused across an application, for example, for a data bound table control with dynamic rows |
Design | Writing doesn't require much application designing because they are authored at design time and mostly contain static data | Writing from scratch requires a good understanding of the control's life cycle and the order in which events execute, which is normally taken care of in user controls |
Friday, October 15, 2010
Extract Only Date from Date time field
Today, one of my friend asked me, how to extract only Date from Datetime field.
The following SQL Script helps to Extract only Date from DateTime field, it will ignore the time and display as "00:00:00.000".
Select convert(varchar, getdate(), 101)
The following SQL Script helps to Extract only Date from DateTime field, it will ignore the time and display as "00:00:00.000".
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
Here I used the GetDate() function. In the Same way, we can use any datefield column.
There are other ways also there, but datatype and Dateformat is differentSelect convert(varchar, getdate(), 101)
Select convert(varchar, getdate(), 102)
Select convert(varchar, getdate(), 103)
Select convert(varchar, getdate(), 104)
Select convert(varchar, getdate(), 105)
Select convert(varchar, getdate(), 106)
Select convert(varchar, getdate(), 107)
Thursday, October 7, 2010
Current user account is not a member of the VS Developers group
Problem:
Today, when i tried to run my web application from Visual Studio IDE, it throws the error:
1. open a command window. At the command prompt, type: COMPMGMT.MSC
(Or)
Right Click on My Computer, Select Manage
2. Select Groups from "Local Users and Groups"
3. Double click on "VS Developers"
4. Click Add, Enter username, then click on "Check Names" to resolve your id
5. Click Ok to add the user to Group.
Now if you run your program, it will work.
:-)
Today, when i tried to run my web application from Visual Studio IDE, it throws the error:
Visual Studio .NET cannot create or open the application because the current user account is not a member of the VS Developers group on the Web server computer.Solution:
1. open a command window. At the command prompt, type: COMPMGMT.MSC
(Or)
Right Click on My Computer, Select Manage
2. Select Groups from "Local Users and Groups"
3. Double click on "VS Developers"
4. Click Add, Enter username, then click on "Check Names" to resolve your id
5. Click Ok to add the user to Group.
Now if you run your program, it will work.
:-)
Wednesday, October 6, 2010
Unexpected Error 0x8ffe2740
System throws "Unexpected Error 0x8ffe2740 occured.", when i trying to start IIS. This kind of error will occur when there is a port conflict.
IIS is configured with the port number 80.
The following command will help to find the port usage,
netstat -anop TCP|find ":80 "
In the result file look if port 80 is LISTENING. If so, another program is using port 80.
Solution:
1.Close the Application, which is using the port no #### (port number 80 in my case)
Information:
In my case 'SKYPE' was causing the problem; In the Skype options i found: 'Connection: use port 80 as an alternative.'
After closed the skype, I Started IIS, It works.
:)
IIS is configured with the port number 80.
The following command will help to find the port usage,
netstat -anop TCP|find ":80 "
In the result file look if port 80 is LISTENING. If so, another program is using port 80.
Solution:
1.Close the Application, which is using the port no #### (port number 80 in my case)
Information:
In my case 'SKYPE' was causing the problem; In the Skype options i found: 'Connection: use port 80 as an alternative.'
After closed the skype, I Started IIS, It works.
:)
C#: Find Century from Year
Today one of friend asked me, how to find century from the year thru C# code. The following code snippet helps:
int year = 2010;
int cent = year / 100;
year %= 100;
if (year > 0)
cent = cent + 1;
Console.WriteLine("{0}C",cent);
Output:
21C
int year = 2010;
int cent = year / 100;
year %= 100;
if (year > 0)
cent = cent + 1;
Console.WriteLine("{0}C",cent);
Output:
21C
Error: SQL Server Native Client cannot be found
Problem:
Today I tried to install SQL Server 2005 Developer edition in my system. During the installation, it throws the given error:
---------------------------
Microsoft SQL Server 2005 Setup
---------------------------
An installation package for the product Microsoft SQL Server Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'.
---------------------------
OK
---------------------------
Cause:
System already contains another version of "SQL Server Native Client". So that it throws the error.
Solution:
Uninstall "SQL Server Native Client" thru "Add and Remove Programs"
Re-install SQL Server 2005 Again
Today I tried to install SQL Server 2005 Developer edition in my system. During the installation, it throws the given error:
---------------------------
Microsoft SQL Server 2005 Setup
---------------------------
An installation package for the product Microsoft SQL Server Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'.
---------------------------
OK
---------------------------
Cause:
System already contains another version of "SQL Server Native Client". So that it throws the error.
Solution:
Uninstall "SQL Server Native Client" thru "Add and Remove Programs"
Re-install SQL Server 2005 Again
Subscribe to:
Posts (Atom)