Hi, I have a webpart that contain a CMSRepeater control:
<cms:CMSRepeater ID="CMSRepeater1" runat="server> <ItemTemplate> <li><span><%# Container.ItemIndex + 1 %></span><img id="<%#Eval("EventTemplateID")%>" class="droppable" src="~/CMSPages/GetFile.aspx?guid=<%# CMS.Controls.CMSAbstractTransformation.Methods.IfCompare(Eval("TemplateThumbnail"),"00000000- 0000-0000-0000-000000000000",Eval("TemplateThumbnail"),Eval("TemplateImage")) %>" width="160" height="150" /></li> </ItemTemplate> </cms:CMSRepeater>
In the code behind:
string customTableClassName = "customtable.InvitationBanner"; DataClassInfo customTable = DataClassInfoProvider.GetDataClassInfo(customTableClassName); foreach (var itemEquipment in CMSRepeater1.Items) { //here i want to get img tag id value which is in eval value }
how can i get img tag id value from eval template id in code behind
Thanks and Regards, Rajendrasinh Jadeja
A few things:
<ItemTemplate>
if you must create a custom webpart, use the API to loop through your data, don't loop through the data in the repeater.
var tableItems = CMS.CustomTables.CustomTableItemProvider.GetItems("customtable.InvitationBanner").Where("Column1 = 'something'").OrderBy("Column1"); CMSRepeater1.DataSource = tableItems; CMSRepeater1.DataBind();
foreach (CMS.CustomTables.CustomTableItem cti in tableItems) { string templateImage = cti.GetValue("TemplateImage", ""); }
Hi Brenden Kehren,
Thank you for your response i will try it.
Please, sign in to be able to submit a new answer.