Click here to Skip to main content
15,887,477 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Lossing Sessions and static varaibles becoming null Pin
Parwej Ahamad23-Feb-10 4:58
professionalParwej Ahamad23-Feb-10 4:58 
GeneralRe: Lossing Sessions and static varaibles becoming null Pin
Satish - Developer23-Feb-10 20:39
Satish - Developer23-Feb-10 20:39 
QuestionOrder by Pin
Qasim198423-Feb-10 2:48
professionalQasim198423-Feb-10 2:48 
AnswerRe: Order by Pin
R. Giskard Reventlov23-Feb-10 5:09
R. Giskard Reventlov23-Feb-10 5:09 
GeneralRe: Order by Pin
Qasim198423-Feb-10 5:13
professionalQasim198423-Feb-10 5:13 
GeneralRe: Order by Pin
R. Giskard Reventlov23-Feb-10 5:24
R. Giskard Reventlov23-Feb-10 5:24 
GeneralRe: Order by Pin
Qasim198423-Feb-10 5:29
professionalQasim198423-Feb-10 5:29 
Questionjava date validation Pin
Member 395625723-Feb-10 2:22
Member 395625723-Feb-10 2:22 
<script language="javascript" type="text/javascript">
var dtCh = "/";
var minYear = 1900;
var maxYear = 2100;

function daysInFebruary(year) {
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
for (var i = 1; i <= n; i++) {
this[i] = 31
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
if (i==2) {this[i] = 29}
}
return this
}

function stripCharsInBag(s, bag) {
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (bag.indexOf(c) == -1)
returnString += c;
}

return returnString;
}

function isInteger(s) {
var i;
for (i = 0; i < s.length; i++) {
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}

function isDate(dtStr) {
var daysInMonth = DaysArray(12)
var pos1 = dtStr.indexOf(dtCh)
var pos2 = dtStr.indexOf(dtCh, pos1+1)
var strMonth = dtStr.substring(0, pos1)

var strDay = dtStr.substring(pos1+1, pos2)
var strYear = dtStr.substring(pos2+1)
strYr = strYear
if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1)
if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1)
}
month = parseInt(strMonth)
day = parseInt(strDay)
year = parseInt(strYr)
if (pos1 == -1 || pos2 == -1){
//alert("The date format should be : mm/dd/yyyy")
return false
}
if (strMonth.length < 1 || month < 1 || month > 12){
//alert("Please enter a valid month")
return false
}
if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
//alert("Please enter a valid day")
return false
}

if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear){
//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
return false
}
if (dtStr.indexOf(dtCh,pos2+1)!= -1 || isInteger(stripCharsInBag(dtStr, dtCh)) == false){
//alert("Please enter a valid date")
return false
}

return true
}

function CheckDate(oSrc,args){

var fromDate = document.getElementById('TextBox1').value;
var toDate = document.getElementById('TextBox2').value;

if (isDate(fromDate) == true && isDate(toDate) == true){
var isvalid = 1;
var d1;
var d2;
d1 = fromDate;
d2 = toDate;
//Total time for one day
var one_day = 1000*60*60*24;
//Here we need to split the inputed dates to convert them into standard format
//for furter execution
var x = d1.split("/");
var y = d2.split("/");
//date format(Fullyear,month,date)


// var date1 = new Date(x[2], (x[0]-1), x[1]);
// var date2 = new Date(y[2], (y[0]-1), y[1]);
// var month1 = x[0]-1;
// var month2 = y[0]-1;

var date1 = new Date(x[2], (x[1]-1), x[0]);
var date2 = new Date(y[2], (y[1]-1), y[0]);
var month1 = x[1]-1;
var month2 = y[1]-1;

//Calculate difference between the two dates, and convert to days
diff = Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(diff < 0) {
isvalid = 0;
}
if(eval(isvalid) == 0) {
args.IsValid = false;
return;
}
else {
args.IsValid = true;
}
}
else {
args.IsValid = true;
}
}


</script>
dhdh

AnswerRe: java date validation Pin
R. Giskard Reventlov23-Feb-10 2:27
R. Giskard Reventlov23-Feb-10 2:27 
Questionlogin control - aspnet_regsql.exe Pin
arkiboys23-Feb-10 1:49
arkiboys23-Feb-10 1:49 
AnswerRe: login control - aspnet_regsql.exe Pin
Not Active23-Feb-10 1:55
mentorNot Active23-Feb-10 1:55 
GeneralRe: login control - aspnet_regsql.exe Pin
arkiboys23-Feb-10 2:30
arkiboys23-Feb-10 2:30 
GeneralRe: login control - aspnet_regsql.exe Pin
Not Active23-Feb-10 5:38
mentorNot Active23-Feb-10 5:38 
QuestionMaking url clickable in textbox Pin
sumit703423-Feb-10 0:38
sumit703423-Feb-10 0:38 
AnswerRe: Making url clickable in textbox Pin
R. Giskard Reventlov23-Feb-10 0:56
R. Giskard Reventlov23-Feb-10 0:56 
GeneralRe: Making url clickable in textbox Pin
sumit703423-Feb-10 1:13
sumit703423-Feb-10 1:13 
GeneralRe: Making url clickable in textbox Pin
R. Giskard Reventlov23-Feb-10 2:25
R. Giskard Reventlov23-Feb-10 2:25 
AnswerRe: Making url clickable in textbox Pin
J4amieC23-Feb-10 2:02
J4amieC23-Feb-10 2:02 
Questionhow to convert hyperlink to label? Pin
Tridip Bhattacharjee23-Feb-10 0:31
professionalTridip Bhattacharjee23-Feb-10 0:31 
AnswerRe: how to convert hyperlink to label? Pin
Brij23-Feb-10 2:38
mentorBrij23-Feb-10 2:38 
Questiontabcontrol not working when using select command of gridview Pin
.NET- India 23-Feb-10 0:27
.NET- India 23-Feb-10 0:27 
Questionlogout problem Pin
Any_India23-Feb-10 0:08
Any_India23-Feb-10 0:08 
AnswerRe: logout problem Pin
JustWorking23-Feb-10 1:16
JustWorking23-Feb-10 1:16 
GeneralRe: logout problem Pin
Any_India23-Feb-10 1:30
Any_India23-Feb-10 1:30 
AnswerRe: logout problem Pin
Jörgen Andersson23-Feb-10 11:33
professionalJörgen Andersson23-Feb-10 11:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.