📄 ajax与freetextbox解决方案 - bolik‘s aio blog - 博客园.htm
字号:
style="BACKGROUND: white; COLOR: maroon">getElementById</SPAN><SPAN
style="BACKGROUND: white">(</SPAN><SPAN
style="BACKGROUND: white; COLOR: red">"<%= Editor.ClientID
%>_htmlEditorArea"</SPAN><SPAN style="BACKGROUND: white">).</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">addEventListener</SPAN><SPAN
style="BACKGROUND: white">(</SPAN><SPAN
style="BACKGROUND: white; COLOR: red">'change'</SPAN><SPAN
style="BACKGROUND: white">, </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Editor_OnClientTextChanged</SPAN><SPAN
style="BACKGROUND: white">, </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">true</SPAN><SPAN
style="BACKGROUND: white">); </SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: blue"></</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">script</SPAN><SPAN
style="BACKGROUND: white; COLOR: blue">></SPAN></P>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: blue"></</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">form</SPAN><SPAN
style="BACKGROUND: white; COLOR: blue">></SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: blue"></</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">body</SPAN><SPAN
style="BACKGROUND: white; COLOR: blue">></SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: blue"></</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">html</SPAN><SPAN
style="BACKGROUND: white; COLOR: blue">></SPAN></P></DIV>
<P>FreeTextBoxPage.aspx.cs 文件</P>
<DIV
style="FONT-SIZE: 10pt; BACKGROUND: #f8f8f8; COLOR: black; FONT-FAMILY: consolas">
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Data</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Configuration</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Collections</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Security</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">UI</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">UI</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">WebControls</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">UI</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">WebControls</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">WebParts</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">using</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">UI</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">HtmlControls</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px"><SPAN
style="BACKGROUND: white; COLOR: navy">namespace</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">AIO</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">WITWeb</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">{</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">public</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">partial</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">class</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: olive">FreeTextBoxPage</SPAN><SPAN
style="BACKGROUND: white"> : </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">System</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Web</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">UI</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: olive">Page</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white"> {</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">protected</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">string</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">HtmlEditorHiddenFieldID</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">protected</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">void</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Page_Load</SPAN><SPAN
style="BACKGROUND: white">(</SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">object</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">sender</SPAN><SPAN
style="BACKGROUND: white">, </SPAN><SPAN
style="BACKGROUND: white; COLOR: olive">EventArgs</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">e</SPAN><SPAN
style="BACKGROUND: white">)</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
{</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">HtmlEditorHiddenFieldID</SPAN><SPAN
style="BACKGROUND: white"> = </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Request</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">QueryString</SPAN><SPAN
style="BACKGROUND: white">[</SPAN><SPAN
style="BACKGROUND: white; COLOR: red">"HtmlEditorHiddenFieldID"</SPAN><SPAN
style="BACKGROUND: white">];</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">if</SPAN><SPAN
style="BACKGROUND: white"> (!</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">IsPostBack</SPAN><SPAN
style="BACKGROUND: white">)</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
{</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: maroon">Editor</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Text</SPAN><SPAN
style="BACKGROUND: white"> = </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Session</SPAN><SPAN
style="BACKGROUND: white">[</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">HtmlEditorHiddenFieldID</SPAN><SPAN
style="BACKGROUND: white">].</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">ToString</SPAN><SPAN
style="BACKGROUND: white">();</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
}</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
}</SPAN></P>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">public</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">string</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Text</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
{</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">get</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
{</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">return</SPAN><SPAN
style="BACKGROUND: white"> </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">this</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Editor</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Text</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
}</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">set</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
{</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
</SPAN><SPAN style="BACKGROUND: white; COLOR: navy">this</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Editor</SPAN><SPAN
style="BACKGROUND: white">.</SPAN><SPAN
style="BACKGROUND: white; COLOR: maroon">Text</SPAN><SPAN
style="BACKGROUND: white"> = </SPAN><SPAN
style="BACKGROUND: white; COLOR: navy">value</SPAN><SPAN
style="BACKGROUND: white">;</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
}</SPAN></P>
<P style="MARGIN: 0px"><SPAN style="BACKGROUND: white">
}</SPAN></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -