WebRadioButton.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using FastReport.Dialog;
  3. using static FastReport.Web.Constants;
  4. namespace FastReport.Web
  5. {
  6. public partial class Dialog
  7. {
  8. private void RadioButtonClick(RadioButtonControl rb, string data)
  9. {
  10. bool oldValue = rb.Checked;
  11. rb.Checked = data == "true";
  12. rb.FilterData();
  13. rb.OnClick(null);
  14. if (oldValue != rb.Checked)
  15. rb.OnCheckedChanged(EventArgs.Empty);
  16. }
  17. private string GetRadioButtonHtml(RadioButtonControl control)
  18. {
  19. string id = GetControlID(control);
  20. string html = $"<span style=\"{GetRadioButtonStyle(control)}\">" +
  21. $"<input style=\"vertical-align:middle;width:{Zoom(10)}px;border:none;padding:0;margin:0 5px 0 0;\"" +
  22. $" type=\"radio\" name=\"{control.Name}\" value=\"{control.Text}\"" +
  23. $" onclick=\"{GetEvent(ONCLICK, control, SILENT_RELOAD, $"document.getElementById('{id}').checked")}\"" +
  24. $" id=\"{id}\" {(control.Checked ? "checked" : "")} {(control.Enabled ? "" : "disabled")}/>" +
  25. $"<label style=\"{GetControlFont(control.Font)}\" for=\"{id}\">{control.Text}</label></span>";
  26. return html;
  27. }
  28. private string GetRadioButtonStyle(RadioButtonControl control)
  29. {
  30. return GetStandardStyle(control);
  31. }
  32. }
  33. }