Wednesday, June 20, 2012

Maximum 255 character textbox counter set

  <link rel="canonical" href="" />
<script language = "Javascript">
 * DHTML textbox character counter script. Courtesy of (

var bName = navigator.appName;
function taLimit(taObj) {
    if (taObj.value.length==maxL) return false;
    return true;

function taCount(taObj,Cnt) {
    if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
    if (objCnt) {
        if(bName == "Netscape"){   
    return true;
function createObject(objId) {
    if (document.getElementById) return document.getElementById(objId);
    else if (document.layers) return eval("document." + objId);
    else if (document.all) return eval("document.all." + objId);
    else return eval("document." + objId);


<fb:like ref="top_left"></fb:like>
<iframe src=""></iframe>

<div id="content">
  <g:plusone size="small"></g:plusone>

    <script type="text/javascript">
      window.___gcfg = {
        lang: 'en-US'

      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = '';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);

<font> Maximum Number of characters for this text box is 255.<br>
<textarea onKeyPress="return taLimit(this)" onKeyUp="return taCount(this,'myCounter')" name="Description" rows=7 wrap="physical" cols=40 Maxlength="255">
You have <B><SPAN id=myCounter>255</SPAN></B> characters remaining
for your description...</font>


Remove duplicates from a datatable..

using System.Data;

using System.Linq;

DataTable dt = ds.Tables[0];

DataView dv = new DataView(dt);

string cols = string.Empty;

foreach (DataColumn col in dt.Columns)


if (!string.IsNullOrEmpty(cols)) cols += ",";

cols += col.ColumnName;


dt = dv.ToTable(true, cols.Split(','));



To select time format in hh:mm (AM/PM) format

SELECT REPLACE(REPLACE(RIGHT('0'+LTRIM(RIGHT(CONVERT(varchar,getdate(),100),8)),7),'PM',' PM'),'AM',' AM')