WebCheckBox.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using FastReport.Dialog;
  2. using System;
  3. using System.Web;
  4. using System.Web.UI;
  5. using System.Web.UI.WebControls;
  6. namespace FastReport.Web
  7. {
  8. public partial class WebReport : WebControl, INamingContainer
  9. {
  10. private void CheckBoxClick(CheckBoxControl cb, string data)
  11. {
  12. bool oldValue = cb.Checked;
  13. cb.Checked = data == "true";
  14. cb.FilterData();
  15. cb.OnClick(null);
  16. if (oldValue != cb.Checked)
  17. cb.OnCheckedChanged(EventArgs.Empty);
  18. }
  19. private string GetCheckBoxHtml(CheckBoxControl control)
  20. {
  21. string id = Prop.ControlID + control.Name;
  22. return string.Format("<span class=\"{0}\" style=\"{1}\"><input style=\"vertical-align:middle;padding:0;margin:0 5px 0 0;\" type=\"checkbox\" name=\"{2}\" value=\"{3}\" onclick=\"{4}\" id=\"{5}\" {6} {7}/><label style=\"{9}\" for=\"{5}\">{8}</label></span>",
  23. // class
  24. "",
  25. // style
  26. GetCheckBoxStyle(control),
  27. // name
  28. control.Name,
  29. // value
  30. control.Text,
  31. // onclick
  32. GetEvent("onclick", control, string.Format("document.getElementById('{0}').checked", id)),
  33. // title
  34. id,
  35. control.Checked ? "checked" : "",
  36. control.Enabled ? "" : "disabled",
  37. control.Text,
  38. GetControlFont(control.Font)
  39. );
  40. }
  41. private string GetCheckBoxStyle(CheckBoxControl control)
  42. {
  43. return GetStandardStyle(control);
  44. }
  45. }
  46. }