HyperLink 传参数要使传递的参数为字符串
传1个参数
方法1:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# String.Format("~/practice/cookie2.aspx?id={0}", Eval("id"))
%>'>inid</asp:HyperLink>
方法2:
<asp:HyperLink id="Hyperlink1" NavigateUrl='<%# string.Format("List.aspx?Id={0}",DataBinder.Eval(Container.DataItem,"ID"))%>' runat="server">查看</asp:HyperLink>
方法3:
<asp:HyperLink id=Hyperlink2 NavigateUrl= ' <%# "Detail.aspx?Code= "+DataBinder.Eval(Container.DataItem, "N_ID ")%> ' text= ' <%# DataBinder.Eval(Container.DataItem, "N_title ") %> ' Runat= "server ">
asp:HyperLink ID= "NewsTitle1 " Text= ' <%# Left(CType(DataBinder.Eval(Container.DataItem, "Title "),String),20)+ "... "%> ' NavigateUrl= ' <%# "newsDetail.aspx?id= "+DataBinder.Eval(Container.DataItem, "id ").ToString() %> ' Target=_blank Runat=server />
传递多个参数
方法1:
<asp:HyperLink ID="statedm" runat="server"
NavigateUrl='<%# "UserManger.aspx?udid="+DataBinder.Eval(Container.DataItem,"Udid").ToString()+"&udid="+DataBinder.Eval(Container.DataItem,"State").ToString()%>'></asp:HyperLink>
方法2:
<asp:HyperLink id=Hyperlink2 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Pro_name"," {0}") %>' NavigateUrl='<%#DataBinder.Eval(Container.DataItem, "pro_id","product.aspx?id={0}")+ "&pro_type="+DataBinder.Eval(Container, "DataItem.Pro_type")%>'>