How do you set href attribute of anchor tag that is within a repeater in code behind?

后端 未结 4 1485
庸人自扰
庸人自扰 2021-01-25 06:23

normally on would use the following :-

aspx page:-

Link1 

code behind:-

4条回答
  •  迷失自我
    2021-01-25 07:19

    First you need to make your control server side by putting runat="Server"

        Link1 
    
    protected void rptOuter_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
           // Find your anchor here
        }
    }
    

提交回复
热议问题