Thursday, November 21, 2013

Get the records Count of RADGRID using Jquery


<script type="text/javascript">
function RowCount()
{
    var grid = $find("<%=RadGrid1.ClientID %>");
    var MasterTable = grid.get_masterTableView();
    var Rows = MasterTable.get_dataItems();
    alert(Rows.length);
}
</script>

Show selected div on radiobutton list selection using Jquery

<label><input id="rdb1" type="radio" name="toggler" value="1" />Money</label>
<label><input id="rdb2" type="radio" name="toggler" value="2" />Interest</label>

<div id="blk-1" class="toHide" style="display:none">
    First Div
</div>
<div id="blk-2" class="toHide" style="display:none">
    Second Div
</div>

$(function() {
    $("[name=toggler]").click(function(){
            $('.toHide').hide();
            $("#blk-"+$(this).val()).show('slow');
    });
 });

Friday, November 8, 2013

Default location for storing the .SqlLite DB file on MAC

Default Location:
~/Library/Application Support/iPhone Simulator/[SDK version]/Applications/[App GUID]/Documents

To find the path at Finder (Hint):
Right Click on Finder -> Select Go to Folder -> Enter the following 
~/Library/Application Support/iPhone Simulator/




Monday, October 21, 2013

Regular Expression for Email

var regEmail = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$";

Wednesday, September 25, 2013

Execute Stored Procedure in Select Statement in SQL Server

How to execute SP in Select Query:

Declare @YourTable table (Column1 int, Column2 int, Column nvarchar(100))

INSERT @YourTable
EXECUTE YourStoredProcedure @InParameter = @InParameterValue

Select * From @YourTable


Note: Columns of temporary table vairables should be same as that of the return rows of the Stored Procedure.


Happy Coding :)

Thursday, August 29, 2013

Regular Expression to strip HTML tags from String in C#

Regex.Replace(htmlString, @"<[^>]*>", String.Empty)

Send Mail using Gmail Host in asp.net

/* Code to Send Mail using Gmail Host Server Settings in asp.net   */

                    var fromAddress = new MailAddress("FromAddress@abc.com", "Display Name");
                    var toAddress = new MailAddress("ToAddress@abc.com", "Display Name");

                    var smtp = new SmtpClient
                    {
                        Host = "smtp.gmail.com",
                        Port = 587,
                        EnableSsl = true,
                        DeliveryMethod = SmtpDeliveryMethod.Network,
                        UseDefaultCredentials = false,
                        Credentials = new NetworkCredential(fromAddress.Address, "GmailPassword")
                    };

                    var message = new MailMessage(fromAddress, toAddress)
                    {
                        Subject = "MailSubject",
                        Body =  "Mail Body",
                        IsBodyHtml = true
                    };

                    smtp.Send(message);