Link to home
Start Free TrialLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

ASP.NET - AHRef - Query String Parameter

I need to add 2 query string parameters.  The first is from a value from a dataitem.  The second is from a Response.Write.  How do you write it?

<a href='gotopage.aspx?ID=<%#DataBinder.Eval(Container, "dataItem.my_id")%> + '&2ID=<%Response.Write(ViewState["ID"].ToString());%>' >
        <%#DataBinder.Eval(Container, "dataItem.t_id")%>
</a>

I am passing in two ID's.  One from a database and one from the ViewState from the page.

Thanks.
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

No need for the response.Write . . . just use the ViewState["ID"].ToString().

Also I'm not sure if a numeric can start a query string parameter.  Changed "2ID" to "ID2"


<a href='gotopage.aspx?ID=<%#DataBinder.Eval(Container, "dataItem.my_id") + "&ID2=" + ViewState["ID"].ToString();%>' >
        <%#DataBinder.Eval(Container, "dataItem.t_id")%>
   <%#DataBinder.Eval(Container, "dataItem.t_id")%>
</a>
Avatar of CipherIS

ASKER

I'm receiving the below error:

Line 314:     <a href='gotopage.aspx?ID=<%#DataBinder.Eval(Container, "dataItem.mbt_id") + "&ID2=" + ViewState["ID"].ToString();%>' >

Compiler Error Message: CS1026: ) expected
ASKER CERTIFIED SOLUTION
Avatar of CipherIS
CipherIS
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
FIgured out the solution