kahlua001 Posted February 8, 2007 Posted February 8, 2007 I have a problem I cant figure out. any help is appreciated! I have a datalist whose's datasource is a custom type. In this type is a public member that is a generic list. So in the ItemDataBound event I have. PostType Post = ((PostUserBookmarkType)e.Item.DataItem).Post; lnkName.Text = Post.Name; Now, the problem is that I am taking the datalist's item template and loading from a usercontrol. So now, the ItemDataBound doesnt work becuase its outside of a datalist, so I've read that I need to cast the Dataitem to a DataListItem like so.. <%# DataBinder.Eval(((DataListItem)Container).DataItem, "FirstName") %> I've tried different variations to cast my PostType to a DataListItem but get invalid casting errors. Anybody know the correct way to take my 1st line of code and cast that to a DataListItem which gets casted to my custom type?? Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.