Dynamically populate checkboxlist in Asp.Net C#
In my project, in the database view I have the USERs list with their descriptions and what Type of USers are they. For Eg. Some USer Type are : DE, Some others are : admin etc etc etc.
So now I want to populate the CheckBoxList on PageLoad.
- If CheckBoxList1 = "DE" then all the UsersNames of Type "DE" will the displayed.
- If CheckBoxList2 = "admin" then all the UsersNames of Type "admin" will the displayed.
- If CheckBox开发者_如何学PythonList3 = "Coord" then all the UsersNames of Type "Coord" will the displayed.
- etc etc
then I will select whether I should give permission to the whole group or only to a particular user.
I couldn't Bind the Checkboxlist and populate the UsersName according to the UserType.
You could try use.OrderBy = "Order By User_Name, UserRole_Id
. Basically, you add a second parameter to the Order By clause, telling the sql to sort by two priorities. The syntax might be slightly off, but that should give you the idea.
You might also want to look into Linq or a strongly-typed DataSet, if you're calling SQL Server.
精彩评论