I want to add HTML div conditionally in rotator control. I am using the following code but it says "The name container does not exist in the current context" at DataBinder.Eval(Container.DataItem, "COL_ID")
<telerik:RadRotator ID="rtrList" runat="server" Width="830px" Height="100px"
FrameDuration="10" RotatorType="ButtonsOver" ScrollDuration="450" WrapFrames="true"
ItemWidth="100" ItemHeight="80" >
<ItemTemplate>
<asp:HiddenField ID="hdfId" runat="server" Value='<%# Eval("COL_ID") %>' />
<div id="div" runat="server" title='<%# Eval("NAME") %>' class="widget_item">
<span>
<%# Eval("TITLE") %>
</span>
</div>
<%if (Convert.ToInt32(DataBinder.Eval(Container.DataItem, "COL_ID")) % 2 == 0)
{%>
<div></div>
<%} %>
</ItemTemplate>
</telerik:RadRotator>
Please guide me where I am wrong. as I am using DataBinder.Eval & Container.DataItem for the first time.
Regards, Kash
The error implies that this data item does not exist in the item bound to the control.
For example. If you were binding to a table, the table must have a column called "Col_ID" or this will throw an error.
Can you add your code for binding the control to the data source?