我通过这段代码创建文本框:
<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="true" 的建议:
<div style="clear:left;">
<asp:TextBox TextMode="MultiLine" runat="server" AutoPostBack="true" ID="selectText" ReadOnly="true" Width="560px" Height="50px"></asp:TextBox>
</div>
但这没有帮助