How to set a custom id for listitems in BulletedList control while binding?

Posted by Amr ElGarhy on Stack Overflow See other posts from Stack Overflow or by Amr ElGarhy
Published on 2010-03-08T13:06:00Z Indexed on 2010/03/08 14:21 UTC
Read the original article Hit count: 276

Filed under:
|
|

I am binding a BulletedList control in page load to a datasource, what i want to do is to set custom IDs for this BulletedList's ListItems while binding
This custom ID will be in my current case "li_"+ItemId.ToString()

Sample Code i used to fill the bulletedList:

bulletedList.DataSource = MyDataCollection;
bulletedList.DataTextField = "Name";
bulletedList.DataValueField = "Id";
bulletedList.DataBind();

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#