如果下拉选择的索引已更改,则文本区域中的文本会在下方移动一行 [英] Text in text area moves one line below on the event of drop down selected index changed

查看:64
本文介绍了如果下拉选择的索引已更改,则文本区域中的文本会在下方移动一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我用一个下拉菜单和一个textarea创建了一个表单。当我从下拉列表中选择值时。文本区域中的文本在下面移动一行。当单击在页面加载时输入文本时,我的textarea中的光标不会从头开始。

但如果我从下拉列表中删除自动回发=true,则不会发生此问题。所以,如果有人知道这个问题的解决方案,请告诉我。

 <   asp:DropDownList     ID   =  ddlRegItemMainGroupCodeDesc    runat   =  server   < span class =code-attribute> CssClass   =  ddset    AutoPostBack   =  true    TabIndex   =  4    OnSelectedIndexChanged   =  ddlRegItemMainGroupCodeDesc_SelectedIndexChanged >  
< / asp:DropDownList >
< asp:TextBox ID = txtRegSubGroupDescription runat = server < span class =code-attribute> class = txtfield2 TextMode = MultiLine onKeyDown = textMaxCounter(this,200,cphContent_RegSubGroupDescription) 高度 = 70px 宽度 = 252px >
< / asp:TextBox > ;



C#



  protected   void  ddlRegItemMainGroupCodeDesc_SelectedIndexChang ed( object  sender,EventArgs e)
{
ddlItemMainGroupCodeDesc.SelectedValue = ddlRegItemMainGroupCodeDesc.SelectedValue;
}

解决方案

您可以使用更新面板

 <   asp:UpdatePanel     runat   =  server    ID   =  YourID >  
< contenttemplate >
< asp:TextBox ID = txtRegSubGroupDescription runat = server class = < span class =code-keyword> txtfield2 TextMode = MultiLine onKeyDown = textMaxCounter(this,200,cphContent_RegSubGroupDescription) 高度 = 70px 宽度 = 252px >
< / asp:TextBox >
< / contenttemplate < span class =code-keyword>>
< / asp:UpdatePanel >


即使在使用更新面板后,我也遇到了这个问题。

Hello,

I have created a form using one drop down and one textarea. When i select value from drop down. the text in text area moves one line below. and The cursor in my textarea is not starting at the beginning when clicked to enter text on page load.
But if i remove auto postback="true" from drop down this problem is not occurring. so Let me know if any one know the solution for this Problem.

  <asp:DropDownList ID="ddlRegItemMainGroupCodeDesc" runat="server" CssClass="ddset" AutoPostBack="true" TabIndex="4" OnSelectedIndexChanged="ddlRegItemMainGroupCodeDesc_SelectedIndexChanged">
</asp:DropDownList>
   <asp:TextBox ID="txtRegSubGroupDescription" runat="server" class="txtfield2" TextMode="MultiLine" onKeyDown="textMaxCounter(this, 200, cphContent_RegSubGroupDescription)" Height="70px" Width="252px">
</asp:TextBox>


C#

protected void ddlRegItemMainGroupCodeDesc_SelectedIndexChanged(object sender, EventArgs e)
      {
          ddlItemMainGroupCodeDesc.SelectedValue = ddlRegItemMainGroupCodeDesc.SelectedValue;
      }

解决方案

You can use update panel

<asp:UpdatePanel runat="server" ID="YourID">
    <contenttemplate>
        <asp:TextBox ID="txtRegSubGroupDescription" runat="server" class="txtfield2" TextMode="MultiLine" onKeyDown="textMaxCounter(this, 200, cphContent_RegSubGroupDescription)" Height="70px" Width="252px">
        </asp:TextBox>
    </contenttemplate>
</asp:UpdatePanel>


Even after using update panel i am getting this problem.


这篇关于如果下拉选择的索引已更改,则文本区域中的文本会在下方移动一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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