I create textbox by this code:
<div style="clear:left;">
<asp:TextBox TextMode="MultiLine" runat="server" ID="selectText" ReadOnly="true" Width="560px" Height="50px"></asp:TextBox>
</div>
I fill it by this code:
elSelText.value = elSelText.value.substr(0, position) + chosenoption2.value + " ";
And then i try to send value in textbox to server, but it’s empty!
protected void btnUseSelectClick(object sender, EventArgs e)
{
sourceDetails.SelectCommand += " and " + selectText.Text;
Session["FilterSelectCommand"] = sourceDetails.SelectCommand;
tableResults.DataBind();
}
On the advice I added 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>
but it didn’t help
Although it’s news to me, it seems that the
ReadOnlyproperty doesn’t keep track of changes from the client. If you want the “readonly” functionality but still get the value on the server, put the following in yourPage_Loadmethod:And remove the
ReadOnly(andAutoPostBack) property in the<asp:TextBox>tag.( From: http://aspadvice.com/blogs/joteke/archive/2006/04/12/16409.aspx and http://forums.asp.net/t/1467081.aspx – it was a fairly quick find with Google)