RadioButtonList
Owns all the properties and functions of DropDownList.
It presents a list of radio buttons.
Property:
RepeatDirection: Direction of layout
RepeatLayout: Table layout or flow layout
RepeatColumns: A row shows several
CheckBoxList
Owns all the properties and functions of RadioButton.
The rendering is a check box.
Skills:
1. How do I get the selected multiple items?
Gets the check box's selected value.
Idea: Iterate through each item in the check box list to determine the selection of each item.
foreach (ListItem li in Checkboxlist1.items)
{
if (li. Selected)
{
Label2.Text + = li. Value + ",";
}
}
2. How do I set a few items and select them? (0528 videos 117 min.)
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ Important Important ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
Sets the item specified in the text box (each item separated by |) is selected
Idea: Resolve the value of the item you want to select from the text box, and then iterate through each item to determine if it is specified in the text box, and then set to select, not set to unchecked.
Checkboxlist1.selectedindex =-1;
string s = TextBox1.Text;
string[] ss = S.split (' | '); Resolves the value values to be selected
foreach (ListItem li in Checkboxlist1.items)
{
if (ss. Contains (li. Value))
{
Li. Selected = true;
Continue
}
}
Method One:
Method Two:
ListBox: List box
Owns all the properties of the DropDownList control.
Selectionmode-single,multiple By default is a single radio or multiple selection
If it is a single radio, follow the dropdown list.
If it is more choice, do it according to CheckBoxList.
Example: 0528 video 30 minutes provincial three-level linkage
repeate---- 0528 Video two 20 minutes
Repeater uses templates to design the interface. It has five templates: headertemplate,footertemplate,itemtemplate,alternatingitemtemplate,seperatortempate
Simple Data Display ideas:
1. Use the template in the HTML interface to design the display interface.
2. In the C # interface, query the data and bind the display.
Steps:
1. Drag the repeater onto the interface.
Do the interface
2. Use DW to do the interface.
3. Make the DW interface and open it up to repeater different templates.
4. Use <%# eval ("Column name/attribute name")%> eval equivalent to stitching assignment
To do the code:
5. Querying data in C # code
6. Bind the queried data to the repeater display.
Picture Gaga
Ha ha
Xx
Yy
Display on the control interface with C # code:
1. Write functions in C # code. Null parameter, return string, public
2. In the HTML repeater template, call the method above.
webform--Fifth Lecture (composite control)