[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Pass Date Value in Querystring

Posted on 2010-03-30
3
Medium Priority
?
300 Views
Last Modified: 2012-05-09
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

0
Comment
Question by:Senz79
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
darshan_derasari earned 2000 total points
ID: 29079424
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
 
LVL 4

Author Comment

by:Senz79
ID: 29082262
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
 
LVL 5

Assisted Solution

by:darshan_derasari
darshan_derasari earned 2000 total points
ID: 29093390
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question