Reputation: 3
I can easily pass the textbox input to a variable in an HTML form, but things don't work when using a master page and ContentPlaceHolder.
My Master page is "Site.Master" My sister page is "Page1.aspx"
In it I have asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" Runat="Server", with textBox1.
How to get that input ?
protected void Button1_Click(object sender, EventArgs e)
{
string MyContent = TextBox1.Text;
}
This action returns the original text of TextBox1 but not what the user input.
Upvotes: 0
Views: 192
Reputation: 3
Ahh, of course... I forgot the "if (!Page.IsPostBack)" in Page_Load.
Upvotes: 0
Reputation: 27
Please check your Textbox has runat="server" property like
<asp:textbox id="txtName" runat="server"/>
Upvotes: 0