//calling this function inside an event
public
void
loadGrid()
{
//looping for creating 31 columns
for
(
int
I_ColumnCount = 1; I_ColumnCount <= 31; I_ColumnCount++)
{
GridTemplateColumn gridtemplatecolumn =
new
GridTemplateColumn();
gridtemplatecolumn.ItemTemplate =
new
MyTemplate(Convert.ToString(I_ColumnCount));
gridtemplatecolumn.HeaderText = Convert.ToString(I_ColumnCount);
this
.rg_Attendence.MasterTableView.Columns.Add(gridtemplatecolumn);
ViewState[
"grid_DayCount"
]=Convert.ToString(I_ColumnCount);
}
}
public
class
MyTemplate : ITemplate
{
protected
RadComboBox lblControl;
public
string
colname;
public
MyTemplate(
string
cName)
{
colname = cName;
}
public
void
InstantiateIn(System.Web.UI.Control container)
{
lblControl =
new
RadComboBox();
lblControl.ID = colname;
container.Controls.Add(lblControl);
}
}
//this function contains data which is retrieved from database and need to bind to rad grid and comboboxes(which are created inside rad grid dynamically)
protected
void
loadEmployees()
{
RadComboBox lblControl =
new
RadComboBox();
DataTable DT_Employee =
new
DataTable();
DT_Employee = BLL.get_Attendance(_obj_Smhr_Attendance);
if
(DT_Employee.Rows.Count == 0)
{
rg_Attendence.Visible =
true
;
rg_Attendence.DataSource = DT_Employee;
rg_Attendence.DataBind();
for
(i = 0; i <= rg_Attendence.Items.Count - 1; i++)
{
//here i am trying to bind data to comboboxes which are created dynamically inside rad grid
rcmbList = rg_Attendence.Items[i].FindControl(
"lblControl"
)
as
RadComboBox;
if
(Convert.ToString(Convert.ToString(DT_Employee.Rows[i][3])) ==
"0"
)
rcmbList.SelectedIndex = rcmbList.FindItemIndexByValue(Convert.ToString(
"P"
));
else
if
(Convert.ToString(Convert.ToString(DT_Employee.Rows[i][3])) ==
"1"
)
rcmbList.SelectedIndex = rcmbList.FindItemIndexByValue(Convert.ToString(
"L"
));
}
}
else
{
rg_Attendence.Visible =
false
;
btn_Save.Visible =
false
;
btn_Finalize.Visible =
false
;
}
}
else
{
_obj_Smhr_Attendance.OPERATION = operation.Check;
_obj_Smhr_Attendance.ATTENDANCE_MODE =
true
;
DT_Employee = BLL.get_Attendance(_obj_Smhr_Attendance);
rg_Attendence.Visible =
true
;
rg_Attendence.DataSource = DT_Employee;
rg_Attendence.DataBind();
for
(i = 0; i <= rg_Attendence.Items.Count - 1; i++)
{
//here i am trying to bind data to comboboxes which are created dynamically inside rad grid
lblControl = rg_Attendence.Items[i].FindControl(
"colname"
)
as
RadComboBox;
if
((Convert.ToString(Convert.ToString(DT_Employee.Rows[i][2]))).Trim() ==
"P"
)
{
lblControl.SelectedIndex = lblControl.FindItemIndexByValue(Convert.ToString(
"P"
));
}
else
if
((Convert.ToString(Convert.ToString(DT_Employee.Rows[i][2]))).Trim() ==
"L"
)
{
lblControl.SelectedIndex = lblControl.FindItemIndexByValue(Convert.ToString(
"L"
));
}
}
}
}
}
Hi @
I am using Telerik Rad list boxes in my application The list box's are inside Telerik:RadAjaxPanel. I some time get the following error when the page with RadListbox loads.
This is a show stopper in my application. I am forced to go back to asp:list boxes.
The content page is inside a Nested Master Page and master page contain the Rad tab strip.
Please help me how to get rid of this Issue.
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Wed, 9 Mar 2011 09:47:16 UTC
Message: Sys.InvalidOperationException: Component 'ctl00_ctl00_ContentPlaceHolder1_Main_uclFieldSelection_RHSListBox' was not found.
Line: 4599
Char: 25
Code: 0
URI: ScriptResource.axd?d=qlvRxOrmpywM_08z8refchHddcbVZsvK4Ywotss_Ymd_2hJVYkLcDxVnLi_OeSkv8B6tfayteJ6SVeKd7o_DwYe4725KqPpiYzA653aPMP_F0rYUNPf5bufsZONZE3BA1W0wDg2&t=ffffffffcb989f59
I have tried the following options without any success:
1) Made sure that ScriptResource.axd reference is in web.config <httphandlers> and <handlers> section.
2) I have replaced the telerik:radajaxpanel with asp:updatepanel
3) I have removed all the client side events from the list boxes.
4) I have made sure that order of ScriptManager is at the top of any other controls
Please suggest me how to proceed.