填充后,我通过这段代码创建文本框:文本框为空,用JavaScript
<div style="clear:left;">
<asp:TextBox TextMode="MultiLine" runat="server" ID="selectText" ReadOnly="true" Width="560px" Height="50px"></asp:TextBox>
</div>
我往里面这段代码:
elSelText.value = elSelText.value.substr(0, position) + chosenoption2.value + " ";
然后我尝试在文本值发送到服务器,但它是空的!
protected void btnUseSelectClick(object sender, EventArgs e)
{
sourceDetails.SelectCommand += " and " + selectText.Text;
Session["FilterSelectCommand"] = sourceDetails.SelectCommand;
tableResults.DataBind();
}
在建议我加的AutoPostBack = “真”:
<div style="clear:left;">
<asp:TextBox TextMode="MultiLine" runat="server" AutoPostBack="true" ID="selectText" ReadOnly="true" Width="560px" Height="50px"></asp:TextBox>
</div>
,但它并没有帮助
只是一个猜测,但并移除'只读=“真”'有所作为? –
文本框的值为空,因为服务器不知道它已更改。服务器需要以某种方式得到通知。通常,这是通过全部或部分回发完成的。 – Daniel
@Doc我认为这就是'protected void btnUseSelectClick(){}'是 – Ian