ListItem custom attributes not restored after postback

Posted by Divs99 under C# on 7/10/2012 | Points: 10 | Views : 1869 | Status : [Member] | Replies : 0
The following code:

ListItem li = rbl.Items.FindByValue(rbl.SelectedValue);
if (li != null)
li.Attributes.Add("style", "font-weight:bold");

works ok, but if the page is posted-back the attributes get lost.
ASP .NET does not save attributes of ListItem in ViewState so attributes of ListItem are not persisted between postbacks. Thus the behaviour observed is as expected.

pls help me out.......


(No response found.)

Login to post response