<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"> <asp:ListItem Value="1000000">Sun</asp:ListItem> <asp:ListItem Value="0100000">Mon</asp:ListItem> <asp:ListItem Value="0010000">Tue</asp:ListItem> <asp:ListItem Value="0001000">Wed</asp:ListItem> <asp:ListItem Value="0000100">Thu</asp:ListItem> <asp:ListItem Value="0000010">Fri</asp:ListItem> <asp:ListItem Value="0000001">Sat</asp:ListItem> </asp:CheckBoxList></td>
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { //checkboxlist (Days) foreach(ListItem objItem in CheckBoxList1.Items) { if (objItem.Selected) { DailyDay += objItem.Value + ""; } } }
<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"> <asp:ListItem Value="64">Sun</asp:ListItem> <asp:ListItem Value="32">Mon</asp:ListItem> <asp:ListItem Value="16">Tue</asp:ListItem> <asp:ListItem Value="8">Wed</asp:ListItem> <asp:ListItem Value="4">Thu</asp:ListItem> <asp:ListItem Value="2">Fri</asp:ListItem> <asp:ListItem Value="1">Sat</asp:ListItem> </asp:CheckBoxList></td>
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { CheckBoxList cbl = (CheckBoxList)sender; int dec = cbl.Items.Cast<ListItem>() .Where(li => li.Selected) .Sum(li => int.Parse(objItem.Value)); DailyDay = Convert.ToString(dec, 2); }
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { //checkboxlist (Days) int total = 0; foreach(ListItem objItem in CheckBoxList1.Items) { if (objItem.Selected) { DailyDay += objItem.Value + ""; total += cint(objitem.Value); } } }
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { //checkboxlist (Days) int total = 0; foreach (ListItem objItem in CheckBoxList1.Items) { if (objItem.Selected) { //DailyDay = (objItem.Value + ""); total += Convert.ToInt32(objItem.Value); string formatint = string.Format("{0:0000000}", total); DailyDay = formatint; } } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง