Ads 468x60px

Pages

Blogroll

Monday, June 4, 2012

Set datetime on IIS


Go into Registry Editor (start -> run -> type regedit).
Get into the folder HKEY_USERS -> .DEFAULT -> International.
Look for the key sShortDate, right click -> Modify...
Change the Value data for d/M/yyyy.
Log off. Then next time you log in, dates should be work as you wanted.

Friday, May 18, 2012

Insert multiple rows at once in SQL Server


  INSERT INTO lsItemLink(ItemID,ownerID,Item2ID ) SELECT @ItemID,@OwnerID, TopicList.value('.[1]', 'int') AS TopicID      
  FROM @CommunityItemIDs.nodes('//Communities/Community') AS R(TopicList

Monday, April 9, 2012

Send Mail via Gmail account



Add these two namespaces at the top of the page first.

using System.Net.Mail;


using System.Net;

Then add the below function on your page and pass the required parameters.
/// <summary>
    /// 
    /// Send Mail from your application via gmail account
    /// 
    /// Your gmail id/// your gmail password/// Mail id to whom you want to send mail/// Suject of the mail/// Body of the mailpublic void SendMail(string sourceGmailMailID,string gmailPassword, string destinatioMailID,string subject, string body)
    {
        var client = new SmtpClient("smtp.gmail.com", 587)
        {
            Credentials = new NetworkCredential(sourceGmailMailID, gmailPassword),
            EnableSsl = true
        };
        client.Send(sourceGmailMailID, destinatioMailID, subject, body);
    }
http://stackoverflow.com/questions/1644201/how-can-i-display-code-better-on-my-blogger-blog
To send the mail to multiple receptionists pass the destinatioMailID parameter with comma (,) separated source mail ids like "abc@gmail,xyz.yahoo@com" etc.

Tuesday, February 28, 2012

JQuery Calender


<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Using jQuery UI from the CDN</title>
    <style type="text/css"">
        html, body
        {
            background-color: #fff;
            font-family: Arial, Helvetica, sans-serif;
            font-size: 12px;
            line-height: 18px;
            color: #52697E;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="DatepickerDiv">
        Event start date:
        <asp:TextBox ID="txtEventStartDate" runat="server" /><br />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" /><br />
        <asp:Literal ID="litMessage" runat="server" />
    </div>
    </form>

    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" type="text/javascript"></script>

    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.js" type="text/javascript"></script>

    <link href=" http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/start/jquery-ui.css" rel="Stylesheet" type="text/css" />

    <script type="text/javascript">

        $(document).ready(function() {
        var currentYear = (new Date).getFullYear();
        $("#txtEventStartDate").datepicker({
                showButtonPanel: true,
                changeMonth: true,
                changeYear: true,
                yearRange: '1901:' + currentYear + ''
            });
        });

    </script>

</body>
</html>

Friday, February 17, 2012

Render Section in MVC3

Define in page:
@RenderSection("ValidationRules ", true)

@if (IsSectionDefined("ValidationRules"))
{
@section ValidationRules
{
//Put your html code here
    @Html.LabelFor(m => m.Subject)
}
}