Rajeshk_cgm
asked on
Order by in Session DataTable using linq / or some other method
hi i need to bind the gird values from session datatable(using order by)
thanks in advance..
thanks in advance..
public void ItemsToGrid()
{
if (Session["ItemsToGrid"] == null)
{
DataTable dt = new DataTable("ItemsToGrid");
dt.Columns.Add(new DataColumn("ItemID", typeof(string)));
dt.Columns.Add(new DataColumn("ItemName", typeof(string)));
dt.Columns.Add(new DataColumn("UOM", typeof(string)));
dt.Columns.Add(new DataColumn("Quantity", typeof(int)));
Session["ItemsToGrid"] = dt;
}
}
in button click event am adding the rows into the Session datatable
try
{
string itemname;
string itemid;
if (this.ddltype.SelectedIndex == 0)
{
itemname = asbProduct.Text.ToString();
itemid = asbProduct.SelectedValue.ToString();
}
else
{
itemname = txtItemName.Text;
itemid = "0";
}
string UOM = txtUOM.Text;
int quantity = Convert.ToInt32(txtquantity.Text.ToString().Trim());
DataTable dt = new DataTable("ItemTable");
dt = (DataTable)Session["ItemsToGrid"];
DataRow dr;
dr = dt.NewRow();
dr["ItemID"] = itemid;
dr["ItemName"] = itemname;
dr["UOM"] = UOM;
dr["Quantity"] = quantity;
dt.Rows.Add(dr);
// Here i need to do the group by with the datatable
Session["ItemsToGrid"] = dt;
AddGridItems();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.