These lists of check boxes could either be dynamic or static.
Static:
Static in the sense the list of check boxes are pre defined in the aspx.
Example:-
When we run this aspx page, we get the page as
We can observe the lists of check boxes displayed in the page are because of the predefined check box items in the check box list control.
Dynamic:
Some times, it may be required to display a list of check boxes which are dynamic.
Example:-
Say, it may be required to populate all the roles available in the database while adding a user.
So we can display these lists of roles as check boxes which are dynamic.
In this case we read all the role names available in database and bind those as data source to this check box list.
You can observe there are no predefined check boxes in the check box list.
This page expects a query string as “Items” with list list of roles or values seperated by comma’s
Output:-
If we request for this page as
/CheckBoxList.aspx?Items=Admin,Viewer,Editor
Then it should display the page with 3 check boxes for Admin, Viewer and Editor roles.
No comments:
Post a Comment