Any workaround possible?!
Thank you
Regards
Raj
3 Answers, 1 is accepted
I tried to reproduce this problem locally but unfortunately to no avail. Please see my code below and let me know what is missing.
Default.aspx
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"true"
>
</
telerik:RadGrid
>
Default.aspx.cs
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
RadGrid1.NeedDataSource += (s, a) => { RadGrid1.DataSource = Enumerable.Range(0, 100); };
}
Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Getting this error message in ItemDatabound method:
DataBinding: 'System.Int32' does not contain a property with the name 'WorkTaskID'.
ItemDatabound
try
{
if (e.Item is GridHeaderItem)
{
GridHeaderItem item = e.Item as GridHeaderItem;
CheckBox chkHeaderSelect = (CheckBox)item.FindControl("chkHeaderSelect");
if (chkHeaderSelect != null)
{
chkHeaderSelect.Attributes.Add("OnClick", "SelectAll(" + chkHeaderSelect.ClientID + ");");
}
}
if (e.Item is GridDataItem)
{
GridDataItem dataBoundItem = e.Item as GridDataItem;
if (dataBoundItem["TaskStatus"].Text == "Rejected")
{
dataBoundItem.BackColor = System.Drawing.Color.IndianRed;
dataBoundItem.ForeColor = System.Drawing.Color.White;
dataBoundItem.Font.Bold = true;
}
else if ((dataBoundItem["TaskStatus"].Text == " ")
&& (dataBoundItem["AllocatedDate"].Text != " ")
&& (dataBoundItem["IssuedDate"].Text == " "))
{
dataBoundItem.BackColor = System.Drawing.Color.LightSkyBlue;
dataBoundItem.Font.Bold = true;
}
else if ((dataBoundItem["TaskStatus"].Text == " ")
&& (dataBoundItem["CompanyName"].Text != " ")
&& (dataBoundItem["AllocatedDate"].Text != " ")
&& (dataBoundItem["IssuedDate"].Text != " "))
{
dataBoundItem.BackColor = System.Drawing.Color.LightGreen;
dataBoundItem.Font.Bold = true;
}
else if ((dataBoundItem["TaskStatus"].Text == " ")
&& (dataBoundItem["AllocatedDate"].Text == " ")
&& (dataBoundItem["IssuedDate"].Text == " ")
&& (dataBoundItem["RepeatFlag"].Text == "Y"))
{
dataBoundItem.BackColor = System.Drawing.Color.LemonChiffon;
dataBoundItem.Font.Bold = true;
}
//Repeat of RM_PS
if (dataBoundItem["IsPSJob"].Text == "True")
{
dataBoundItem.BackColor = System.Drawing.Color.LightSeaGreen;
dataBoundItem.ForeColor = System.Drawing.Color.White;
dataBoundItem.Font.Bold = true;
}
if (dataBoundItem["CusAddress"] != null && dataBoundItem["CusAddress"].Text.Length > 15)
{
dataBoundItem["CusAddress"].ToolTip = dataBoundItem["CusAddress"].Text;
dataBoundItem["CusAddress"].Text = dataBoundItem["CusAddress"].Text.Substring(0, 15) + "...";
}
if (dataBoundItem["VerifiedAddress"] != null && dataBoundItem["VerifiedAddress"].Text.Length > 15)
{
dataBoundItem["VerifiedAddress"].ToolTip = dataBoundItem["VerifiedAddress"].Text;
dataBoundItem["VerifiedAddress"].Text = dataBoundItem["VerifiedAddress"].Text.Substring(0, 15) + "...";
}
if (dataBoundItem["CusName"] != null && dataBoundItem["CusName"].Text.Length > 15)
{
dataBoundItem["CusName"].ToolTip = dataBoundItem["CusName"].Text;
dataBoundItem["CusName"].Text = dataBoundItem["CusName"].Text.Substring(0, 15) + "...";
}
ImageButton btnView = (ImageButton)dataBoundItem.FindControl("btnView");
string repeatPriorityID = dataBoundItem.GetDataKeyValue("RepeatPriorityID") != null ? dataBoundItem.GetDataKeyValue("RepeatPriorityID").ToString() : string.Empty;
if (!string.IsNullOrEmpty(repeatPriorityID))
{
if (btnView != null)
{
if (repeatPriorityID.Equals("1"))
{
btnView.ImageUrl = "../Images/RedView.JPG";
}
else if (repeatPriorityID.Equals("2"))
{
btnView.ImageUrl = "../Images/YellowView.JPG";
}
}
}
#region RB1C0 (If job was reported before 1PM of the current day)
string reportedDateTime = dataBoundItem.GetDataKeyValue("ReportedDateTime") != null ? dataBoundItem.GetDataKeyValue("ReportedDateTime").ToString() : string.Empty;
DateTime currentDate = Utilities.GetDateTime(DateTime.Now.ToString(Constant.DateFormat.DDMMYYYY) + " 13:00:00.000");
if (!string.IsNullOrEmpty(reportedDateTime))
{
DateTime? ReportedDateTime = Utilities.GetNullableDateTime(reportedDateTime);
if (ReportedDateTime < currentDate)
{
if (btnView != null)
{
if (!string.IsNullOrEmpty(repeatPriorityID))
{
if (repeatPriorityID.Equals("1"))
{
//RB1C0 and 7 days repeats
btnView.ImageUrl = "../Images/RedViewRB1C0.JPG";
}
else if (repeatPriorityID.Equals("2"))
{
//RB1C0 and 7 - 30 days repeats
btnView.ImageUrl = "../Images/YellowViewRB1C0.JPG";
}
}
else
{
//RB1C0 but no repeats
btnView.ImageUrl = "../Images/ViewRB1C0.JPG";
}
}
}
}
#endregion
}
}
catch (Exception exception)
{
Utility.ShowErrorMessage(this.Page, exception.Message);
}
I'm not sure what should I do with the provided code-snippets and what is the relation between the initial problem and the posted excerpts.
Can you please isolate the problem in a simple, runnable project and then submit it via the support ticket system so that we can debug it locally?
Isolating a problem in a sample project
Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.