Hi,
can anyone please help, I am in the process of converting one of our working basic repeaters into a RadListView.
On the OnItemDataBound event I want to fire some code to format items in the itemtemplate using one of our business objects "tblVehicle" with the following code:
However, at the line
can anyone please help, I am in the process of converting one of our working basic repeaters into a RadListView.
On the OnItemDataBound event I want to fire some code to format items in the itemtemplate using one of our business objects "tblVehicle" with the following code:
protected
void
uiRptCars_ItemDataBound(
object
sender, Telerik.Web.UI.RadListViewItemEventArgs e)
{
if
(e.Item
is
Telerik.Web.UI.RadListViewDataItem)
{
tblVehicle item = ((tblVehicle)e.Item).DataItem;
string
name =
string
.Format(
"{0} {1} {2}"
, item.RegDate.Year, item.Make, item.Model);
string
url =
string
.Format(
"{0} {1} {2}"
, item.Make, item.Model, item.RegDate.Year).ToLower().Replace(
" "
,
"-"
).Replace(
"/"
,
"~"
);
Image uiImgCar = (Image)e.Item.FindControl(
"uiImgCar"
);
Literal uiLitTitle = (Literal)e.Item.FindControl(
"uiLitTitle"
);
Literal uiLitColour = (Literal)e.Item.FindControl(
"uiLitColour"
);
Literal uiLitFuel = (Literal)e.Item.FindControl(
"uiLitFuel"
);
Literal uiLitTrans = (Literal)e.Item.FindControl(
"uiLitTrans"
);
Literal uiLitEng = (Literal)e.Item.FindControl(
"uiLitEng"
);
uiLitTitle.Text =
string
.Format(
"<h3><a href='/cars-for-breaking/{0}/{1}'>{2}</a></h3>"
, item.VehicleId, url, name);
uiLitColour.Text = item.Colour;
uiLitFuel.Text = item.FuelType;
uiLitTrans.Text = item.Transmission;
uiLitEng.Text = item.EngineCode;
uiImgCar.AlternateText = name;
}
}
However, at the line
tblVehicle item = ((tblVehicle)e.Item).DataItem;
I'm getting the following error: Cannot convert type 'Telerik.Web.UI.RadListViewItem' to 'tblVehicle'
I'm sure there is a simple answer to this as everything worked fine under a straightforward repeater control.
Any help would be greatly appreciated.
Regards
Dale