/// <Summary> /// CheckBoxList data source // aggregation // 20130705 //// </summary> private void setCheckBoxList () {DataTable dt = new DataTable (); CheckBoxList1.Items. clear (); dt = geovindu_branchBLL.SelectGeovindu_branchNameDt (); CheckBoxList1.DataSource = dt; this. checkBoxList1.DataTextField = "B _Name"; this. checkBoxList1.DataValueField = "B _EnglishName"; CheckBoxList1.DataBind ();} // <summary> ////// </Summary> /// <param name = "sender"> </param> /// <param name = "e"> </param> protected void Page_Load (object sender, eventArgs e) {if (! IsPostBack) {setCheckBoxList ();}} /// <summary> /// specify the target category of the selected region. /// </summary> /// <param name = "sender"> </param> // /<param name = "e"> </param> protected void button#click (object sender, eventArgs e) {string variable = string. empty; int I = 0; foreach (System. web. UI. webControls. listItem oItem in CheckBoxList1.Items) {if (oItem. selected) // if you want only selected {if (I = 0) {variable = oItem. value;} else {variable = variable + "," + oItem. value;} I ++;} // otherwise get for all items // variable = oItem. value;} // returns the Value of this to the parent plane. page. controls. add (new LiteralControl (string. format ("<script> opener.document.form1.txt ShoppingDealsBranch. value = '{0}' </script> ", variable); // close this window. page. controls. add (new LiteralControl ("<script> window. close (); </script> "));
<Asp: checkBoxList ID = "CheckBoxList1" runat = "server" RepeatDirection = "Horizontal" comment = "True" DataTextField = "B _Name" DataValueField = "B _EnglishName" RepeatColumns = "6" CellPadding = "5 "CellSpacing =" 5 "RepeatLayout =" Table "BorderStyle =" Outset "CssClass =" geovindu "> </asp: checkBoxList> <br/> <asp: Button ID = "Button1" runat = "server" OnClick = "button#click" Text = "Confirm"/> </div>
<style type="text/css"> .geovindu INPUT{ color:black; border-style: none; font-family: Tahoma; font-size: 7px; margin-right: 5px}.geovindu td { /* font-size:x-large;*/ width:300px; } </style>