Thursday, December 20, 2012

Javascript for character count on keypress

 <script language="javascript" type="text/javascript">


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

    function taCount(taObj, Cnt) {
        objCnt = createObject(Cnt);
        objVal = taObj.value;
        if (objVal.length > maxL) objVal = objVal.substring(0, maxL);
        if (objCnt) {
            if (bName == "Netscape") {
                objCnt.textContent = maxL - objVal.length;
            }
            else { objCnt.innerText = maxL - objVal.length; }
        }
        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);
    }


 </script>


==================
It is used like as mention below


 <asp:TextBox ID="txtImportaintInfo" runat="server" TextMode="MultiLine"
                                    CssClass="textarea_field2" Width="681px" onpaste="return false" onkeypress="return taLimit(this)" onkeyup="return taCount(this,'myCounter1')"></asp:TextBox>
                                   
<br />     You have <b><span id="myCounter1">1000</span></b>
                                characters remaining for your description...</td>

Tuesday, December 4, 2012

How to convert Sesstion object to array,arrylist in asp.net

converting sesstion to arry

 string[] arrFile = (string[])Session["arrFile"];

converting sesstion to arraylist

 Arraylist arrFile = (Arraylist)Session["arrFile"];

Adding Symbol like as ❏ and ❑ with string in asp.net

There is two sysbole  with shadow:

&#x274f;
&#x2751;

as ❏ and ❑

You can use it  and display like :


❏ Organising necessary form of order to transfer county court possession order to the High Court

❏ Shergroup Legal to attend High Court in London to organisecollection of necessary paperwork

❏ Experienced eviction locksmith on site to change locks and deal with roller shutters etc

❏ Shergroup Security to handle post eviction security services

❏ Shergroup Security to arrange post eviction cleansing

❏ Shergroup Security Risk Assessment Report to highlight measures to prevent further trespass or damage to      property

❏ Any other service not listed here – let us help you complete your eviction process


For this i have use various check box tick value and concatenated and displayed with this function

 private string ConcatCheckBoxText(CheckBox chkBox)
    {
        string str = chkBox.Checked ? "&#x274f; " + chkBox.Text + "<br/><br/>" : "";
        return str;
    }

This bold value in above function is responsible for adding these symbols  ❏ and ❑  in c#