<html>
<head>
<script type=”text/javascript”>
var shiftOn = false;
var ctrlOn = false;
var altOn = false;
var focusedValue = “0″;
function validateNumeric(obj)
{
if (obj.value.length == 0)
{
obj.value = focusedValue;
return false;
}
[...]
Read Full Post »
<html>
<head>
<title>Demo</title>
<script type=”text/javascript”>
function textChanged(elm)
{
alert(elm.value);
}
onload = function()
{
var elm = document.getElementById(”mytextbox”);
elm.onchange = new Function(’textChanged(this)’);
[...]
Read Full Post »
<input type=”text” id=”mytb” />
To select: document.getElementById(”mytb”).select()
To unselect: document.getElementById(”mytb”).value = document.getElementById(”mytb”).value;
Just the value to itself. That’s all!
Read Full Post »
Posted in SQL, Uncategorized on April 25, 2008 | No Comments »
The query:
select
distinct type from sysobjects
FN: Scalar Valued Functions
P: Stored Procedures
U: Tables
TF Table Valued Functions
How to delete all of the same type?
use
mydb –replace by your own db name
GO
declare
@procName sysnamedeclare
someCursor cursor FORselect
name from sysobjects where type = ‘P’ AND objectproperty(id, ‘IsMSShipped’
= 0 order by name ascopen
someCursor
fetch
next from someCursor into @procName
while
[...]
Read Full Post »
GridViewRow pager = SearchResultsGridView.TopPagerRow;
if (pager != null)
{
[...]
Read Full Post »
Posted in SQL, Uncategorized on April 7, 2008 | No Comments »
DECLARE @Items VARCHAR(1000)
SET @Items = ‘A,B,CD,E,FGH,KL,MNOP,QRSTU,V,W,XYZ’
DECLARE @Item VARCHAR(50)
DECLARE @Pos INT
DECLARE @Loop BIT
SELECT @Loop = CASE WHEN LEN(@Items) > 0 THEN 1 ELSE 0 END
WHILE (SELECT @Loop) = 1
BEGIN
SELECT @Pos = CHARINDEX(’,’, @Items, 1)
IF @Pos > 0
BEGIN
SELECT @Item = SUBSTRING(@Items, 1, @Pos - 1)
SELECT @Items = SUBSTRING(@Items, @Pos + 1, LEN(@Items) - @Pos)
END
ELSE
BEGIN
SELECT @Item = @Items
SELECT [...]
Read Full Post »
Posted in JavaScript, Uncategorized on February 12, 2008 | No Comments »
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”><html xmlns=”http://www.w3.org/1999/xhtml”><head runat=”server”>
<title>Untitled Page</title></head><body>
<form id=”form1″ runat=”server”>
<div>
<script type=”text/javascript”>
var BrowserDetect = {init: function () {
this.browser = this.searchString(this.dataBrowser) || “An unknown browser”;this.version = this.searchVersion(navigator.userAgent)||
this.searchVersion(navigator.appVersion)|| “an unknown version”;
this.OS = this.searchString(this.dataOS) || “an unknown OS”;},
searchString: function (data) {for (var i=0;i<data.length;i++) {
var dataString = data[i].string;var dataProp = [...]
Read Full Post »
Posted in SQL, Uncategorized on December 5, 2007 | No Comments »
The script:
USE SomeDB
DECLARE @name varchar(128), @sql varchar(500)
DECLARE procs CURSOR FAST_FORWARD FOR
SELECT name FROM sysobjects WHERE type = ‘U’ ORDER BY name ASC FOR READ ONLY
OPEN procs
FETCH next FROM procs INTO @name
WHILE [...]
Read Full Post »
Posted in Windows on December 5, 2007 | No Comments »
Here are the steps of installing an X509 certificate in windows:
Installation Steps for DEVAssumptions:
The Microsoft Windows SDK exists on the machine
The certificate name is SomeName
Go to Start > All Programs > Microsoft Windows SDK > CMD Shell
Execute the following command: makecert -r -pe -n “CN=SomeName” -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr LocalMachine -sky [...]
Read Full Post »
Posted in C#, Uncategorized on December 5, 2007 | No Comments »
The goal here is to take advantage of C# 2.0 features as generics and create a reusable data layer capable of calling any stored procedure, with any sets of parameters and returning different sets of results.
The DataUtility class:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;
///
/// Summary description for DataUtility
///
namespace Data
{
[...]
Read Full Post »