Srinivas Mantha
asked on
How to encrypt multiple query string values passing from gridview in asp.net?
The following syntax to encrypt single query string value passing from gridview in asp.net is working properly
However the following syntax to encrypt multiple query string values from gridview is not working.
All parameter values i.e. pid, rnumber and financial year are integers
Can anyone correct the syntax
<asp:HyperLink ID="HyperLink1" NavigateURL='<%# "billingitemsentrylab.aspx?pid=" + HttpUtility.UrlEncode(EncDecMK.Encrypt(Eval("pid").ToString())) %>' Text='<%# Eval("pname") %>' runat= "server">
</asp:HyperLink>
However the following syntax to encrypt multiple query string values from gridview is not working.
<asp:HyperLink ID="HyperLink1" NavigateURL='<%# "adminpatientlabinfo.aspx?pid=" + HttpUtility.UrlEncode(EncDecMK.Encrypt(Eval("pid").ToString()))+ "&rnumber=" HttpUtility.UrlEncode(EncDecMK.Encrypt(Eval("rnumber").ToString())) + "&financialyear=" HttpUtility.UrlEncode(EncDecMK.Encrypt(Eval("financialyear").ToString())) %>' Text='<%# Eval("pname") %>' runat= "server">
</asp:HyperLink>
All parameter values i.e. pid, rnumber and financial year are integers
Can anyone correct the syntax
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# string.Format("adminpatien
HttpUtility.UrlEncode(EncD
Text='<%# Eval("pname") %>'/>
</ItemTemplate>
</asp:TemplateField>
Please see the following link:
http://www.aspsnippets.com/Articles/How-to-bind-and-pass-query-string-in-HyperLink-in-GridView-in-ASPNet.aspx
The above reference uses encryption and decryption code on every page. Instead, in my project i have written the code in separate C# class file and used it where necessary
For example, on aspx page where the gridview is located, I used
<%@ Import Namespace="EncryptDecryptM
And in the destination (target), aspx.cs code file I used
using EncryptDecryptMK;
lblpid.Text = EncDecMK.Decrypt(HttpUtili
lblrnumber.Text = EncDecMK.Decrypt(HttpUtili
lblfyear.Text = EncDecMK.Decrypt(HttpUtili