Author: sukumarraju | Posted on: 10/21/2009 8:56:27 AM | Views : 287

Hi
I am aware some of it and googled enough to get here.
Have a CheckBoxList control on the form, where ListItems are hard coded(aspx) as below.
<Asp:CheckBoxList ID="chkMyChkList" runat="Server" RepeatColumns="2"> <asp:ListItem Value="somevalue" Text="someTex"/> few more ListItems as above </asp:CheckBoxListe>

Now, I want to hide few columns based on user's Role. I can do this using below source code
if(User.IsInRole("someRole")) { chkMyChkList.Items[1].Attributes.Add("style","Display:none;"); }

Question
Using above approach not showing the ListItem in CheckBoxList item. But it does displaying the empty column . So far, the work around i realised is to remove the ListItem based on role as below ...

Go to the complete details ...