Here is the code
protected void StockGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
try
{
if (e.Item is GridFilteringItem)
{
GridFilteringItem filteringItem = e.Item as GridFilteringItem;
(filteringItem[VwStockListMetadata.ColumnNames.StCode].Controls[0] as TextBox).Width = Unit.Percentage(100.0);
(filteringItem[VwStockListMetadata.ColumnNames.StDesc].Controls[0] as TextBox).Width = Unit.Percentage(100.0);
(filteringItem[VwStockListMetadata.ColumnNames.Location].Controls[0] as TextBox).Width = Unit.Percentage(100.0);
(filteringItem[VwStockListMetadata.ColumnNames.StBin].Controls[0] as TextBox).Width = Unit.Percentage(100.0);
(filteringItem[VwStockListMetadata.ColumnNames.StQuantity].Controls[0] as TextBox).Width = Unit.Percentage(100.0);
//(filteringItem[VwStockListMetadata.ColumnNames.StAutoReorder].Controls[0] as DropDownList).Width = Unit.Percentage(100.0);
(filteringItem[VwStockListMetadata.ColumnNames.StArchive].Controls[0] as TextBox).Width = Unit.Percentage(100.0);
//if (filteringItem["StAutoReorder"].Controls.Count == 0)
//{
filteringItem["StAutoReorder"].Controls.Clear();
DropDownList ddList = new DropDownList();
//ddList.ID = "yourID";
ddList.AutoPostBack = true;
ddList.SelectedIndexChanged += new System.EventHandler(ddList_SelectedIndexChanged);
ddList.Items.Add(new ListItem("Clear", "Empty"));
ddList.Items.Add(new ListItem("Checked", "True"));
ddList.Items.Add(new ListItem("Unchecked", "False"));
if (Session["ddlSelValue"] != null)
{
ddList.Items.FindByValue((string)Session["ddlSelValue"]).Selected = true;
}
filteringItem["StAutoReorder"].Controls.Add(ddList);
//ddSet = true;
//}
}
}
catch (Exception ex)
{
IsError(ex);
}
}
protected void ddList_SelectedIndexChanged(object sender, System.EventArgs e)
{
DropDownList ddList = (DropDownList)sender;
Session["ddlSelValue"] = "True";
ViewState[VwStockListMetadata.ColumnNames.StAutoReorder] = ddList.SelectedValue;
StockGrid.MasterTableView.Rebind();
switch (ddList.SelectedValue)
{
case "Empty":
StockGrid.MasterTableView.FilterExpression = "([StAutoReorder] = 'N') ";
foreach (GridColumn column in StockGrid.MasterTableView.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue = String.Empty;
}
StockGrid.MasterTableView.Rebind();
break;
case "True":
StockGrid.MasterTableView.FilterExpression = "([StAutoReorder] = 'Y') ";
foreach (GridColumn column in StockGrid.MasterTableView.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue = String.Empty;
}
StockGrid.MasterTableView.Rebind();
break;
case "False":
StockGrid.MasterTableView.FilterExpression = String.Empty;
foreach (GridColumn column in StockGrid.MasterTableView.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue = String.Empty;
}
StockGrid.MasterTableView.Rebind();
break;
}
}
In the NeedDataSource event handler, add the check box column's filter expression to the FilterExpression property of the table so that it is honored when the user triggers a filter action from another column.
protected void StockGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
PopulateGrid();
}
private void PopulateGrid()
{
try
{
//decimal stId = Convert.ToDecimal(ViewState[VwStockListMetadata.ColumnNames.StId]);
string stockCode = null;
string stockDesc = null;
//decimal stLocId = Convert.ToDecimal(ViewState[VwStockListMetadata.ColumnNames.StLocId]);
string location = null;
string stBin = null;
string stQuantity = null;
bool bAutoReorder=false;
string stArchive = null;
if (StockGrid.MasterTableView.Items.Count != 0)
{
//--------------------------------
//Get the filters entered to apply
//--------------------------------
GridFilteringItem item = StockGrid.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;
stockCode = (item[VwStockListMetadata.ColumnNames.StCode].Controls[0] as TextBox).Text;
stockDesc = (item[VwStockListMetadata.ColumnNames.StDesc].Controls[0] as TextBox).Text;
location = (item[VwStockListMetadata.ColumnNames.Location].Controls[0] as TextBox).Text;
stBin = (item[VwStockListMetadata.ColumnNames.StBin].Controls[0] as TextBox).Text;
stQuantity = (item[VwStockListMetadata.ColumnNames.StQuantity].Controls[0] as TextBox).Text;
if (Session["ddlSelValue"] != null)
if ((item[VwStockListMetadata.ColumnNames.StAutoReorder].Controls[0] as DropDownList).SelectedValue=="True")
bAutoReorder = true;
else
bAutoReorder = false;
stArchive = (item[VwStockListMetadata.ColumnNames.StArchive].Controls[0] as TextBox).Text;
}
VwStockListCollection col = null;
if (Cache["CollectionObject"] == null)
{
col = new VwStockListCollection();
//List<string> LocationList = new List<string>();
// Hashtable htLocations = GetUserLocations();
// foreach (string key in htLocations.Keys)
// {
// LocationList.Add(key);
// }
// col.Query.Where(col.Query.Location.In(LocationList.ToArray()));
col.Query.OrderBy(col.Query.StCode.Ascending);
if (!col.Query.Load())
{
string SqlText = col.Query.es.LastQuery;
StockGrid.DataSource = new Object[0];
return;
}
string SqlText2 = col.Query.es.LastQuery;
Cache.Insert("CollectionObject", col, null, DateTime.MaxValue, TimeSpan.FromHours(2));
}
else
{
col = Cache["CollectionObject"] as VwStockListCollection;
}
//---------------------------------------------
// Now apply the filters the user has selected
//---------------------------------------------
if (!string.IsNullOrEmpty(stockCode))
{
ViewState[VwStockListMetadata.ColumnNames.StCode] = stockCode;
col.Filter = Helper.AndFilter(col.Filter, VwStockListMetadata.ColumnNames.StCode + " LIKE '%" + stockCode + "%'");
}
if (!string.IsNullOrEmpty(stockDesc))
{
ViewState[VwStockListMetadata.ColumnNames.StDesc] = stockDesc;
col.Filter = Helper.AndFilter(col.Filter, VwStockListMetadata.ColumnNames.StDesc + " LIKE '%" + stockDesc + "%'");
}
if (!string.IsNullOrEmpty(location))
{
ViewState[VwStockListMetadata.ColumnNames.Location] = location;
col.Filter = Helper.AndFilter(col.Filter, VwStockListMetadata.ColumnNames.Location + " LIKE '%" + location + "%'");
}
if (!string.IsNullOrEmpty(stBin))
{
ViewState[VwStockListMetadata.ColumnNames.StBin] = stBin;
col.Filter = Helper.AndFilter(col.Filter, VwStockListMetadata.ColumnNames.StBin + " LIKE '%" + stBin + "%'");
}
if (!string.IsNullOrEmpty(stQuantity))
{
ViewState[VwStockListMetadata.ColumnNames.StQuantity] = stQuantity;
col.Filter = Helper.AndFilter(col.Filter, VwStockListMetadata.ColumnNames.StQuantity + " = " + stQuantity );
}
if (Session["ddlSelValue"] != null)
{
if (bAutoReorder==true)
ViewState[VwStockListMetadata.ColumnNames.StAutoReorder] = "True";
else
ViewState[VwStockListMetadata.ColumnNames.StAutoReorder] = "False";
col.Filter = Helper.AndFilter(col.Filter, VwStockListMetadata.ColumnNames.StAutoReorder + " = " + bAutoReorder);
}
string sortExpression = Session["SortExpression"] == null ? string.Empty : (string)Session["SortExpression"];
col.Sort = sortExpression;
StockGrid.DataSource = col;
}
catch (Exception ex)
{
IsError(ex);
}
}
Hi,
I am using radeditor for my application. It showing a error message in track change pop window 'OutOfMemoryException'.
Because I am using a html file in radeditor content which contains more than 1000 lines.
Please the find image file attached, showing error message.
So give any suggestions and how to resolve it.
Thanks in Advance.
Regards
Utchimahali.N


