Monday, October 20, 2014

How to pass multiple QueriesString in HyperLink in GridView.

In Example.aspx

Add following HTML part in <body> Tag

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  Width="100%">
 <Columns>
<asp:TemplateField HeaderText="Register Date" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="65px">
<ItemTemplate>
<asp:Label ID="lbldate" runat="server" Text='<%#Eval("LoginDate","{0:MM/dd/yyyy }")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>

<asp:HyperLink ID="hlEdit" runat="server" Font-Underline="true" NavigateUrl='<%# string.Format("Example2.aspx?Name={0}&EmailID={1}&Mobile={2}",
HttpUtility.UrlEncode(Eval("Name").ToString()), HttpUtility.UrlEncode(Eval("EmailID").ToString()),HttpUtility.UrlEncode(Eval("Mobile").ToString())) %>'>Edit</asp:HyperLink>

</ItemTemplate>
</asp:TemplateField>
</Columns>
  </asp:GridView>

In Example2.cs

Access Privious page QueryStrings using
  
         
  
    protected void Page_Load(object sender, EventArgs e)
    {
        string EmailID = HttpUtility.UrlDecode(Request.QueryString["EmailID"]);
        String Mobile = HttpUtility.UrlDecode(Request.QueryString["Mobile"]);
    }  

No comments:

Post a Comment