Solved

Using HyperLink to pass values based on code behind variables

Posted on 2010-11-23
2
435 Views
Last Modified: 2012-05-10
Hi All

I have a hyperlink that links to the same page itself.
<asp:HyperLink ID="hyprNextMonth" runat="server" NavigateUrl="~/Calendar.aspx?M=" + <%=theCalendarDate.AddMonths(-1) %> ImageUrl="images/arrow_right.gif"/>

I'm trying to pass the next month int  in the NavigateUrl but can't get the code right.
Is there a better way of posting back to the same form as in PostBackURL or viewstate if so please show me how.

Thanks
0
Comment
Question by:iftech
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34199417
It would easier to do what you want from code-behind by dynamically setting the NavigateUrl from code. If you want to do it in markup you could use:

   NavigateUrl='<%# "~/Calendar.aspx?M=" + theCalendarDate.AddMonths(-1) %>'

But if you did that you would have to call DataBind() on the hyperlink from code-behind anyway. Also the code will probably blow up as you have it anyway probably complaining about the format of the URL.
0
 

Author Closing Comment

by:iftech
ID: 34200053
I used code behind to set NavigationURL
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now