Cross tab functionality in ASP.net Pages using databound controls

Posted by Chandan.sahab under Regular Expressions on 5/3/2010 | Views : 5091 | Status : [Member] | Replies : 2
Hi,
I have to show count (data) in my reports on weekly basis, i.e. we have to achieve the functionality of Crosstab in my normal reports.
Pls sugggest the best.




Responses

Posted by: Er.deepakdalal on: 5/3/2010 [Member] Starter

Up
0
Down
Hi Chandan.sahab

Try the below link i hope it will solve your problem


http://www.codeproject.com/KB/aspnet/GridViewDetailsView.aspx

Chandan.sahab, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenmanam on: 5/4/2010 [Member] Starter

Up
0
Down
protected void SetBehavior()

{
bool bHasGridRows = (gvOrders.Rows.Count > 0);
if ((bHasGridRows == false) && (AllowRecordInserting == true))
{
m_ViewMode = ViewMode.DetailsView;
}

switch (m_ViewMode)
{
case ViewMode.Unknown:
pnlGridView.Visible = bHasGridRows;
pnlDetailsView.Visible = !bHasGridRows;
break;

case ViewMode.GridView:
pnlGridView.Visible = true;
pnlDetailsView.Visible = false;
break;

case ViewMode.DetailsView:
pnlGridView.Visible = false;
pnlDetailsView.Visible = true;
break;
}

lbtnReturnToOrdersList.Visible = bHasGridRows;
}

protected void ClearDataViews()
{
gvOrders.DataSource = null;
gvOrders.DataBind();

dvOrders.DataSource = null;
dvOrders.DataBind();
}


protected void BindDataViews()
{
BindDataViews(0);
}


protected void BindDataViews(int _OrderID)
{
CIF.Business.Northwind.Orders _Orders = new CIF.Business.Northwind.Orders();
DataTable dtOrders = null;

if (_OrderID > 0)
{
dtOrders = _Orders.GetDataTable("OrderID", _OrderID.ToString());
dvOrders.DataSource = dtOrders;
dvOrders.DataBind();
SetBehavior(ViewMode.DetailsView);
}
else
{
dtOrders = _Orders.GetDataTable();
if (dtOrders.Rows.Count > 0)
{
DataView dv = dtOrders.DefaultView;
if ((SortExpression != string.Empty) && (SortDirection != string.Empty))
dv.Sort = SortExpression + " " + SortDirection;

gvOrders.DataSource = dv;
gvOrders.DataBind();
}
else
{
if (AllowRecordInserting == true)
{
dvOrders.DataSource = dtOrders;
dvOrders.DataBind();
}
else
{
gvOrders.DataSource = null;
gvOrders.DataBind();
}
}

SetBehavior();
}
}



NaveenKumar

Chandan.sahab, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response