0

I am using Microsoft Visual Web developer 2010. I have a textbox (txtBoxInput) using the code: <input type="text" id="txtBoxInput"/>

I also have an aspn.net button (btnTest) using the code:

<asp:Button ID="btnTest" runat="server" onclick="Button1_Click" Text="Button"/>

And the code in btnTest's event:

protected void Button1_Click(object sender, EventArgs e)
{
    string test = txtBoxInput.Value = "test123";
}

However txtBoxInput control is not detected. Is there a way where writing this C#/aspn.net code can put this string (test) into txtBox.Value. Thanks

0

1 Answer 1

4

You need to add runat="server". Otherwise input won't be visible on server side and you'll need to access posted value trough Request.Form collection.

<input runat="server" type="text" id="txtBoxInput"/>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.