function ValidateDate(CtrlSDate,CtrlEDate) { var SDate = document.getElementById(CtrlSDate).value; var EDate = document.getElementById(CtrlEDate).value; var alertReason1 = 'End Date must be greater than or equal to Start Date.' var alertReason2 = 'End Date can not be less than Current Date.'; var endDate = new Date(EDate); var startDate= new Date(SDate); if(SDate != '' && EDate != '' && startDate > endDate) { alert(alertReason1); document.getElementById(CtrlEDate).value = ""; return false; } else if(SDate == '') { alert("Please enter Start Date"); return false; } else if(EDate == '') { alert("Please enter End Date"); return false; } }
Thursday, 12 April 2012
Start Date Greater Than End Date Validation in Jquery
How to Blinking the Text in Windows Form Applications
1. Open the Visual Studio 2010-->File -->New-->Project-->Select Windows Form
Application -->ClickOK
2. From the Tool Box Take one Label And one Timer
Control.
3. Change the Timer and Label Names.
4. Then Write the Below Code in Form1.CS File
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
private const int _blinkFrequency = 250;
private const int _maxNumberOfBlinks = 1000;
private int
_blinkCount = 0;
public Form1()
{
InitializeComponent();
timer1.Interval = _blinkFrequency; //optional:
set in design code
label1.Text = "Welcome";
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs
e)
{
this.label1.Visible = !this.label1.Visible;
_blinkCount++;
if (_blinkCount == _maxNumberOfBlinks * 2)
{
timer1.Stop();
label1.Visible = true;
}
}
}
}
5. After The Writing Code We Can Get output like This
Below:
How to Use Marquee in WIndows Form Applications
1. Open the Visual Studio 2010-->File -->New-->Project-->Select Windows Form
Application -->ClickOK
2. From the Tool Box Take one Label And one Timer
Control.
3. Change the Timer and Label Names
4. Then Write the Below Code in Form1.CS File.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
private int xPos = 0,
YPos = 0;
public Form1()
{
InitializeComponent();
}
private void
timer1_Tick(object sender, EventArgs e)
{
if (xPos == 0)
{
this.lblText.Location = new System.Drawing.Point(this.Width, YPos);
xPos = this.Width;
}
else
{
this.lblText.Location = new System.Drawing.Point(xPos,
YPos);
xPos -= 2;
}
}
private void
Form1_Load(object sender, EventArgs e)
{
lblText.Text = "Hello this is marquee
text";
xPos = lblText.Location.X;
YPos = lblText.Location.Y;
timer1.Start();
}
}
}
5. After The Writing Code We Can Get output like This
Below:
Wednesday, 28 March 2012
What is the Difference Between Aspx and Ascx page
The .aspx is the actual page, what the user views in their browser, the .ascx is a custom user
control that is used in the .aspx page. You cannot display a .ascx file in a web browser, just
the .aspx page.
.Aspx:
1 .aspx extension is used for web forms.
2 ASP.NET Page uses the extension .aspx For eg: Default.aspx
3 ASP.NET Page begin with a Page Directive. For eg:
<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
4 Usercontrol is code which can be used in webforms.
5 ASP.NET Page can be viewed directly in the Browser.
6 ASP.NET Page has a HTML, Body and Form Element
.Ascx:
1 .ascx extension is used for user control .
2 User Control uses the extension .ascx For eg: WebUserControl.ascx.
3 User Control begin with a Control Directive. For eg:
<%@ Control Language="C#"
AutoEventWireup="true"
CodeFile="WebUserControl.ascx.cs"
Inherits="WebUserControl" %>
4 You can not use webforms in usercontrol.
5 The main advantage of user control is reusability ,u can this control in any number of webforms.
6 User Control cannot be viewed directly in the browser. User Controls are added to WebPages and you view them by requesting a web page in your browser.
7 User Control does not have a HTML, Body or Form element. It is hosted inside an ASP.NET Page.
control that is used in the .aspx page. You cannot display a .ascx file in a web browser, just
the .aspx page.
.Aspx:
1 .aspx extension is used for web forms.
2 ASP.NET Page uses the extension .aspx For eg: Default.aspx
3 ASP.NET Page begin with a Page Directive. For eg:
<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
4 Usercontrol is code which can be used in webforms.
5 ASP.NET Page can be viewed directly in the Browser.
6 ASP.NET Page has a HTML, Body and Form Element
.Ascx:
1 .ascx extension is used for user control .
2 User Control uses the extension .ascx For eg: WebUserControl.ascx.
3 User Control begin with a Control Directive. For eg:
<%@ Control Language="C#"
AutoEventWireup="true"
CodeFile="WebUserControl.ascx.cs"
Inherits="WebUserControl" %>
4 You can not use webforms in usercontrol.
5 The main advantage of user control is reusability ,u can this control in any number of webforms.
6 User Control cannot be viewed directly in the browser. User Controls are added to WebPages and you view them by requesting a web page in your browser.
7 User Control does not have a HTML, Body or Form element. It is hosted inside an ASP.NET Page.
Tuesday, 27 March 2012
mouseover and mouseout by using javascript
<html> <head> <script type="text/javascript"> function bigImg(x) { x.style.height="164"; x.style.width="164"; } function normalImg(x) { x.style.height="32"; x.style.width="32"; } </script> </head> <body> <img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0"
src="smiley.gif" alt="Smiley" width="100" height="80" /> </body> </html>
How to count the start and stop by using JavaScript
<html>
<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;
function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
</script>
</head>
<body>
<form>
<input type="button" value="Start count!" onclick="doTimer()">
<input type="text" id="txt">
<input type="button" value="Stop count!" onclick="stopCount()">
</form>
</body>
</html>
<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;
function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
</script>
</head>
<body>
<form>
<input type="button" value="Start count!" onclick="doTimer()">
<input type="text" id="txt">
<input type="button" value="Stop count!" onclick="stopCount()">
</form>
</body>
</html>
Tuesday, 20 March 2012
How to Insert a particular Number of Records/ rows in a table
create trigger LimitTable
on student
after insert
as
declare @tableCount int
select @tableCount = Count(*)
from student
if @tableCount >15
begin
rollback
end
go
Here Student is the Table Name and LimitTable is the Trigger Name....
on student
after insert
as
declare @tableCount int
select @tableCount = Count(*)
from student
if @tableCount >15
begin
rollback
end
go
Here Student is the Table Name and LimitTable is the Trigger Name....
Subscribe to:
Posts (Atom)