Link to home
Start Free TrialLog in
Avatar of Dinesh Kumar
Dinesh KumarFlag for India

asked on

Repeater question

Hi Experts,

How to find the html img tag in the c# and set its url in the rptVehicles_ItemDataBound event of the Repeater?

HTML Code:
<img src='<%# Eval("VendorLogo","~/TAImages/ServiceProviderLogos/{0}")%>' alt="SP" id="imgVendorLogo" />

C# Code:
 RepeaterItem item = e.Item;
        if (item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            Label lblVendorName = (Label)e.Item.FindControl("lblVendorName");
            if (lblVendorName.Text == "ZCars")
                Image vendorlogo = (Image)e.Item.FindControl("imgVendorLogo");
                vendorlogo.ImageUrl = "abc.jpg";

Please help!

I am getting issue in the underlined code i.e not able to access the img tag.

please not its not server site image but html side.
Avatar of Rajar Ahmed
Rajar Ahmed
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial