Saturday, 9 May 2015

Print html file using javascript

<script type = "text/javascript">
        function PrintPanel() {
            var panel = document.getElementById("<%=pnlMain.ClientID %>");
            var printWindow = window.open('', '', 'letf=0,top=0,width=1100,height=800,toolbar=0,scrollbars=1,status=0,resizable=yes');
            printWindow.document.write('<html><head><title>DIV Contents</title>');
            printWindow.document.write('</head><body >');
            printWindow.document.write(panel.innerHTML);
            printWindow.document.write('</body></html>');
            printWindow.document.close();
            setTimeout(function () {
                printWindow.print();
            }, 500);
            return false;
        }
    </script>

Thursday, 7 May 2015

SQL support date type

create table dbo.UserTable (ID int,DOB datetime,AddedDate datetime2,JoinDate datetimeoffset,upateDate date,lastdate smalldatetime)

Monday, 4 May 2015

How to use Rowspan in Gridview for 1st Column only




Use RowDataBound event instead:
void GridView31_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow )
    {
        if (e.Row.RowIndex % 4 == 0)
        {
            e.Row.Cells[0].Attributes.Add("rowspan", "4");
        }
        else
        {
            e.Row.Cells[0].Visible = false;
        }
    }
}