在另一个文本框中预览文本时出现问题 [英] Problem in previewing Text in another textBox

查看:69
本文介绍了在另一个文本框中预览文本时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在编写时如何在另一个文本框中预览一个文本框中的数据,我使用了Array但对我没有任何帮助?

< pre lang ="HTML">
< table>
< tr>< td>
< asp:标签Id =问题" Text =问题:" runat =服务器"/>

< asp:TextBox ID ="QuestionTextBox" runat ="server"/>
</td></tr>

< tr>< td>
< asp:标签ID =标签" Text =标签:" runat =服务器"/>
< asp:TextBox ID ="tabTextBox" runat =服务器" Width ="550px"/>
</td></tr>
< tr>< td>
< asp:TextBox ID ="explain" runat ="server" Height ="377px" Width ="673px" onkeypress ="document.getElementById(``PreviewTextBox'').value = document.getElementById(''explain'' ).value"TextMode =" MultiLine"AutoPostBack =" true"/>
</td></tr>
< tr>< td>
< asp:标签ID ="preview" Text ="Preview" runat ="server"/>
</td></tr>
< tr>< td>
< asp:TextBox runat ="server" Height ="300px" Width ="673px"
ReadOnly ="false" ID ="PreviewTextBox"
ontextchanged ="PreviewTextBox_TextChanged" BackColor =#F2F2F2"
TextMode ="MultiLine" AutoPostBack ="true"/>
</td></tr>
</table>
</pre>



这是我尝试过但没有帮助的代码.

How to preview data of one text box in another text box while still writing, i use Array but didn''t works for me any help?

<pre lang="HTML">
<table>
<tr><td>
<asp:Label Id="Question" Text="Question:" runat="server"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="QuestionTextBox" runat="server" />
</td></tr>

<tr><td>
<asp:Label ID="tag" Text="Tag:" runat="server" />
<asp:TextBox ID="tabTextBox" runat="server" Width="550px"/>
</td></tr>
<tr><td>
<asp:TextBox ID="explain" runat="server" Height="377px" Width="673px" onkeypress="document.getElementById(''PreviewTextBox'').value = document.getElementById(''explain'').value" TextMode="MultiLine" AutoPostBack="true" />
</td></tr>
<tr><td>
<asp:Label ID="preview" Text="Preview" runat="server"/>
</td></tr>
<tr><td>
<asp:TextBox runat="server" Height="300px" Width="673px"
ReadOnly="false" ID="PreviewTextBox"
ontextchanged="PreviewTextBox_TextChanged" BackColor="#F2F2F2"
TextMode="MultiLine" AutoPostBack="true"/>
</td></tr>
</table>
</pre>



This is the code i have tried but didn''t help.

推荐答案

使用TextBox TextChanged事件.
use TextBox TextChanged event.


您可以尝试一下对其工作进行编码...

在aspx页面中使用javascript

You try this code its work...

Using javascript in aspx page

<asp:TextBox ID="TextBox1" runat="server" onkeyup="document.getElementById('TextBox2').value = document.getElementById('TextBox1').value"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>





启用Autopostback属性为true,然后在codebehind中编写此代码

TextChageEevent



or

Enable Autopostback property is true then write this code in codebehind

TextChageEevent

textbox2.text=textbox1.text;



快乐的编码....



Happy coding....


在TextChageEevent上
textbox1.text = textbox2.text;
On TextChageEevent
textbox1.text=textbox2.text;


这篇关于在另一个文本框中预览文本时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆