Monday, April 2, 2012

get value of a column on dataitembound event of datalist

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
HtmlAnchor anchorCountry = (HtmlAnchor)e.Item.FindControl("anchrCountry");
string code=DataBinder.Eval(e.Item.DataItem, "code");
if (code == "US" || code == "CA")
{
anchorCountry.HRef = "state.aspx";
}
else
{
anchorCountry.HRef = "city.aspx";
}

}

No comments:

Post a Comment

can you please explain me Backpropagation & Gradients in layman language as simple as possible

 Absolutely! Let’s break down backpropagation and gradients in the simplest possible way , like we’re teaching a curious 10-year-old. 🎯...