0

i have this: ( useing Repeater but this bit long with all the fields problem is with this one)

<td valign="top">
<%#DataBinder.Eval(Container.DataItem, "Category")%>
</td>

and :

        RentalCarBL.CarBL bl = new RentalCarBL.CarBL ();

        List<Car> cars = bl.GetAll();

        rpCars.DataSource = cars;

        rpCars.DataBind();

it works fine on all the fields of the class Car all but one the category is a class in it self
how do i make it show the the inner field of the class Category (lets say Category.name)?

Ranhiru Jude Cooray
  • 19,542
  • 20
  • 83
  • 128
user1246950
  • 1,022
  • 2
  • 10
  • 19

2 Answers2

0
DataBinder.Eval(Container.DataItem, "Category") 

returns an object type.

You should convert it to your category's class type first. such as

((YourCategoryClassName)DataBinder.Eval(Container.DataItem, "Category")).CategoryName
Ranhiru Jude Cooray
  • 19,542
  • 20
  • 83
  • 128
iimax
  • 26
  • 2
  • i tryed this but its not leting me use the class(YourCategoryClassName) in the aspx file and i cant add with using in this page so i dont know how to refernces it in ? (should note that all my class obj are in class library ) – user1246950 Aug 06 '12 at 03:06
0

well it seems i had a problem with the DAL but after fixing it still had the problem
but it was sort of easy to fix sens he told me it return the object all i had to do is override the tostring of the Category :) and it workt fine

user1246950
  • 1,022
  • 2
  • 10
  • 19