Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 523k

Link not working

Nov 4 2022 7:35 AM

Hi

I have below code but it is going to localhost:44351/Admin/some website 

I want if Source is Others then link should not go any page. It should display Invoice Value

protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    try
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            RepeaterItem rptitem = e.Item;
            HiddenField hdfInvoice = rptitem.FindControl("hdfInvoice") as HiddenField;
            Literal ltrlSource = rptitem.FindControl("ltrlSource") as Literal;
            if (ltrlSource.Text == "Amazon")
            {
                HLink hypLink = (Link)e.Item.FindControl("hypUrl");
                hypLink.NavigateUrl = some website;
            }

        }
    }
    catch (Exception ex)
    {

    }
}

Thanks


Answers (2)