Thanks so much for your code.
I am scratching my head of why something simple like this is not working. Sorry I haven't tried your code because my code works fine using ID as a parameter. When I replace CompanyName with ID then it's not working. If it works correctly, then when I click a company on page 1 then it should display the details of that company on page 2 but so far it only displays blank page. ID column has data like '1233xxy', CompanyName column has space and special characters such as 'Company A 22-33', 'Company B 33'.
In summary, I have a page that displays Company records in GridView and I have a link, when clicked takes the user to another page, where it displays detailed information of that company.
The code below works fine with it.
<asp:TemplateField HeaderText="Company">
<ItemTemplate>
<asp:Hyperlink ID="ID2" runat="server" Text="Company" target="_xmlwindow"
NavigateURL='<%# Eval("ID", "~/folderA/folderb/CompanyDetails.aspx?ID={0}) %'>
</asp:Hyperlink>
</ItemTemplate>
</asp:TemplateField>
If I replace "CompanyName" with "ID" then my code wouldn't work.
I realize that the CompanyName has space and special characters and so I use Server.UrlEncode but it still didn't work.
I look at the querystring parameter URL is like this: URL?CompanyName=AA+12
In other words, it would put replace a space with a plus sign in the URL on web page.
<asp:TemplateField HeaderText="Company">
<ItemTemplate>
<asp:Hyperlink ID="ID2" runat="server" Text="Company" target="_xmlwindow"
NavigateURL='<%# Eval("ID", "~/folderA/folderb/CompanyDetails.aspx?ID=" + Server.UrlEncode(Eval("CompanyName").ToString())) %'>
</asp:Hyperlink>
</ItemTemplate>
</asp:TemplateField>
Please look at my code and tell me what I did wrong. Thanks so much.