1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using FastReport.Dialog;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace FastReport.Web
- {
- public partial class WebReport : WebControl, INamingContainer
- {
- private void TextBoxChange(TextBoxControl tb, string data)
- {
- tb.Text = data;
- tb.FilterData();
- tb.OnTextChanged(null);
- }
- private string GetValHook()
- {
- return
- "<script>$.valHooks.textarea = {" +
- "get: function(elem) {" +
- "return elem.value.replace(/\\r?\\n/g, \'\\r\\n\');" +
- "}};</script>";
- }
- private string GetTextBoxHtml(TextBoxControl control)
- {
- string id = Prop.ControlID + control.Name;
- if (control.Multiline)
- {
- return
- GetValHook() +
- string.Format("<textarea class=\"{0}\" style=\"{1}\" type=\"text\" name=\"{2}\" onchange=\"{4}\" id=\"{5}\" maxlength=\"{6}\" {7}>{3}</textarea>",
- // class
- "", //0
- // style
- GetTextBoxStyle(control), //1
- // name
- control.Name, //2
- // value
- control.Text, //3
- // onclick
- GetEvent("onchange", control, string.Format("$('#{0}').val()", id)), //4
- //GetEvent("onchange", control, string.Format("document.getElementById('{0}').value", id)), //4
- // title
- id, //5
- control.MaxLength,
- control.Enabled ? "" : "disabled"
- );
- }
- else
- {
- return string.Format("<input class=\"{0}\" style=\"{1}\" type=\"text\" name=\"{2}\" value=\"{3}\" onchange=\"{4}\" id=\"{5}\" maxlength=\"{6}\" {7}/>",
- // class
- "",
- // style
- GetTextBoxStyle(control),
- // name
- control.Name,
- // value
- control.Text,
- // onclick
- GetEvent("onchange", control, string.Format("document.getElementById('{0}').value", id)),
- // title
- id,
- control.MaxLength,
- control.Enabled ? "" : "disabled"
- );
- }
- }
- private string GetTextBoxStyle(TextBoxControl control)
- {
- return string.Format("{0}{1}", GetStandardStyle(control), GetControlAlign(control));
- }
- }
- }
|