September 13, 2012

Find uncommitted Transactions in SQL Server

By using this command one can easily find uncommitted transactions in SQL server.

dbcc openTran()
Output will show :

Transaction start Date and other details

September 12, 2012

Adding subheaders into the gridview rowdatabound event

First Bind data to gridview control in page load event.

   private string Column1 = "";
    protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
        if (e.Row.RowType == DataControlRowType.DataRow)
            DataRowView dr = (DataRowView)e.Row.DataItem;
            Table tbl = e.Row.Parent as Table;
            if (Column1!= dr["Column1"].ToString())
                Column1= dr["Column1"].ToString();
                GridViewRow rowHeader = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
                Literal newCells = new Literal();
                newCells.Text = dr["Header"].ToString();
                TableHeaderCell headerCell = new TableHeaderCell();
                headerCell.ColumnSpan = e.Row.Cells.Count;
                headerCell.BackColor = System.Drawing.Color.Silver;
                headerCell.HorizontalAlign = HorizontalAlign.Left;
                rowHeader.Visible = true;
                grd.Controls[0].Controls.AddAt(tbl.Rows.Count-1, rowHeader);


Leave your comment below !!