when i bind grid without ItemDataBound it bind fine. But when i use it , then it show the Exception of type 'System.OutOfMemoryException' was thrown. error.
Here is my code
protected void griddetails_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
griddetails.MasterTableView.RenderColumns[4].Display = false;
griddetails.MasterTableView.RenderColumns[5].Display = false;
griddetails.MasterTableView.RenderColumns[6].Display = false;
griddetails.MasterTableView.RenderColumns[7].Display = false;
griddetails.MasterTableView.RenderColumns[10].Display = false;
griddetails.MasterTableView.RenderColumns[11].Display = false;
griddetails.MasterTableView.RenderColumns[26].Display = false;
griddetails.MasterTableView.RenderColumns[30].Display = false;
griddetails.MasterTableView.RenderColumns[31].Display = false;
griddetails.MasterTableView.RenderColumns[32].Display = false;
//if (e.Item.RowIndex > -1) // i comment this part but still not working
//{
RadComboBox ddlMT = new RadComboBox();
ddlMT.ID = "ddlMT";
ddlMT.Filter = RadComboBoxFilter.Contains;
ddlMT.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "MT", null, null);
ddlMT.DataTextField = "EmployeeName";
ddlMT.DataValueField = "Empid";
ddlMT.DataBind();
e.Item.Cells[20].Controls.Add(ddlMT);
RadComboBox ddlQA = new RadComboBox();
ddlQA.ID = "ddlQA";
ddlQA.Filter = RadComboBoxFilter.Contains;
ddlQA.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "QA", null, null);
ddlQA.DataTextField = "EmployeeName";
ddlQA.DataValueField = "Empid";
ddlQA.DataBind();
e.Item.Cells[21].Controls.Add(ddlQA);
RadComboBox ddlMT2 = new RadComboBox();
ddlMT2.ID = "ddlMT2";
ddlMT2.Filter = RadComboBoxFilter.Contains;
ddlMT2.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "MT2", null, null);
ddlMT2.DataTextField = "EmployeeName";
ddlMT2.DataValueField = "Empid";
ddlMT2.DataBind();
e.Item.Cells[22].Controls.Add(ddlMT2);
RadComboBox ddlQA2 = new RadComboBox();
ddlQA2.ID = "ddlQA2";
ddlQA2.Filter = RadComboBoxFilter.Contains;
ddlQA2.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "QA2", null, null);
ddlQA2.DataTextField = "EmployeeName";
ddlQA2.DataValueField = "Empid";
ddlQA2.DataBind();
e.Item.Cells[23].Controls.Add(ddlQA2);
RadComboBox ddlQC = new RadComboBox();
ddlQC.ID = "ddlQC";
ddlQC.Filter = RadComboBoxFilter.Contains;
ddlQC.DataSource = Bll.Bal_BindAllEmployeewithRole("ALL", Session["MTUseId"], e.Item.Cells[4].Text, e.Item.Cells[5].Text, "QC", null, null);
ddlQC.DataTextField = "EmployeeName";
ddlQC.DataValueField = "Empid";
ddlQC.DataBind();
e.Item.Cells[24].Controls.Add(ddlQC);
}
//}
}
I think i am creating the control dynamic here it may be due to this. This code bind upto 971 records but after that it show error.
if there is another way to create it, tell me. I want to bind thru it server side not clientside bcoz it can't fullfill my need.