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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. I never thought of that as a solution.
Open in new window
works for me.