Setting value in html control in code behind without making server control

Posted by Muhammad Akhtar on Stack Overflow See other posts from Stack Overflow or by Muhammad Akhtar
Published on 2010-02-24T11:38:00Z Indexed on 2010/04/19 20:03 UTC
Read the original article Hit count: 284

Filed under:
|

Setting value in html control in code behind without making server control

 <input type="text" name="txt" />
    <%--Pleas note I don't want put runat=server here to get the control in code behind--%>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

Code behind

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        //If I want to initlize some value in input, how can I set here
    }
}
protected void Button1_Click(object sender, EventArgs e)
{
    Request["txt"] // Here I am getting the value of input
}

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about htmlcontrols