Encoding Decoding Querystring in ASPX Page
I need to encode querystring from the aspx itself, like we do <%Eval()%>.Below is my html
<asp:HyperLinkField HeaderText="Your Header"
DataNavigateUrlFields="userId"
DataTextField="Your Data Field to Display"
HeaderStyle-HorizontalAli开发者_开发百科gn="Center"
DataNavigateUrlFormatString="mypage.aspx?type=2&userId={0}"
ItemStyle-Width="35%"
ItemStyle-HorizontalAlign="Left"
/>
Here i want to encrypt or simply encode the parameters type and userid so that it will look like encrypted.
I am answering my own post, as a help to others.I have achieved the result and posting the result.
Instead of asp:HyperlinkField , used the code below
<asp:TemplateField HeaderText="Project">
<ItemTemplate>
<asp:HyperLink ID="OpenDoc" runat="server"
NavigateUrl='<%# this.ResolveUrl(string.Format("AddPropertyDetail.aspx?pid={0}&s=1",base64Encode(Eval("PropertyID").ToString()))) %>'
ToolTip="Click here to open the image" Text='<%#Eval("Area") %>'>' Target="_blank">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
精彩评论