Link to home
Start Free TrialLog in
Avatar of RecipeDan
RecipeDan

asked on

Cannot implicitly convert type 'string' to 'System.Web.UI.HtmlControls.HtmlInputText'

I am getting an error the message when I pass a variable from asp:hyperlink to a web page.

Test.aspx
<input type="text" id="BusinessName" runat="server" />
<input type="text" id="Title" runat="server" />

Test.aspx.cs
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BusinessName.Value = Request.QueryString["ID"];
            }
        }

However, here is what i do not understand. On my Test.aspx Page if I only include this:
<input type="text" id="BusinessName" runat="server" /> and not the Title textbox, it works fine.
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
http://localhost:7936/Default.aspx?id=abcdef&id2=Owner
    if (!IsPostBack)
        {
            BusinessName.Value = Request.QueryString["ID"];
            BusinessTitle.Value = Request.QueryString["ID2"];
        }

Open in new window

works for me.
Avatar of RecipeDan
RecipeDan

ASKER

Thank you. I never thought of that as a solution.