Pass Date Value in Querystring

Hello
I have a datagrid with a hyperlink column and i want to pass multiple value in query string. One of the value is ID of type int and anather value is of DateTime.

Now when i alone use the ID field i am able to create the hyperlink column, but when i include the datetime feild the hyperling does not work .

Please help
senz
<asp:HyperLinkField DataNavigateUrlFields="SnhID,SnhInsertedAt" 
                                        DataNavigateUrlFormatString="MessageDetails.aspx?SnhID={0}&SnhInsertedAt={1}" 
                                        DataTextField="SnhID"  HeaderText="Message ID" />

Open in new window

LVL 4
Senz79Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

darshan_derasariCommented:
Look at the below thread where similar issue is discussed. You need to use server.urlencode() method to encode special characters in the date field. Please go through below link.

http://forums.asp.net/t/1029334.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Senz79Author Commented:
I am Able to get the date but how to attach anather value

 

<asp:TemplateField HeaderText="DateTime"> 
<ItemTemplate> 
<asp:HyperLink runat="server" ID="EvtDate" NavigateUrl='<%# "MessageDetails.aspx?EventDate=" + Server.UrlEncode(Eval("snhInsertedAt").ToString()) %>' Text='<%# Eval("snhInsertedAt") %>' /> 
</ItemTemplate> 
</asp:TemplateField>

Open in new window

0
darshan_derasariCommented:
Look at below sample code with multiple values attached for querystring in hyperlink. It is from the same reference site.
<asp:HyperLink ID="Bouncing" runat="server"
                            NavigateUrl='<%# string.Format("BouncingHist.aspx?Department={0}&Final_section={1}&Section={2}&Statement_Date={3}"
                            , Server.UrlEncode(Eval("Department").ToString())
                            , Server.UrlEncode(Eval("Final_section").ToString())
                            , Server.UrlEncode(Eval("Section").ToString())
                            , Server.UrlEncode(Eval("Statement_Date").ToString()) ) %>'
                            Text='<%#Eval("Bouncing")%>' />

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.