如何在<a> anchor tag in asp.net</a>中编码或隐藏查询字符串

时间:2012-12-05 11:45:14

标签: asp.net url encoding

<asp:DataList id="dlmuv" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" CellPadding="2" CellSpacing="2">
    <ItemTemplate>
    <table>
        <tr>
            <td><a href="Default2.aspx?id=<%#Eval("scid") %>"><asp:Image ID="img" runat="server" class="image_frame" ImageUrl='<%#Eval("latmvimage") %>'  Width="160px" Height="120px"/></a>
            </td>
           <td><a href="Custompage.aspx?id=<%#Eval("patha") %>&img=<%#Eval("imgid") %>">1280 x 800</a>&nbsp &nbsp&nbsp
           </td>

2 个答案:

答案 0 :(得分:0)

<a href='<%# Eval("Default2.aspx?id={0}","scid")'><asp:Image .../></a>

答案 1 :(得分:0)

使用javascript ..

<input type = "hidden" id = "hid" value = "101" />
<a id = "lnk" href = "Mypage.aspx">Click</a>


<script type = "text/javascript">
$("#lnk").live("click", function () {
window.location =  $(this).href +'?Id=' + $("#hid").val();
});
</script>