WebRadioButton.cs 1.6 KB

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