473,473 Members | 1,511 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calender control - how to get the day hyperlink

yarbrough40
320 Contributor
Gang, using the dayrender event I'd like to cast the hyperlink that displays the day to a linkbutton or some type of aspx control to where I can apply some custom javascript to it. For the life of me I can't figure out how to do this. Cast, CType, DirectCast don't work. The control renders itself as a <a href></a> literal control . Any tips on an approach?
Dec 30 '12 #1
11 2300
Rabbit
12,516 Recognized Expert Moderator MVP
Can you post the code you've tried along with any error messages?
Dec 31 '12 #2
yarbrough40
320 Contributor
I'm not at my machine now but a code example is something like
Expand|Select|Wrap|Line Numbers
  1. DIm lb as LinkButton = CType(e.cell.Controls(0),LinkButton)
the error is 'cannot cast type LiteralControl to type LinkButton...'

Anyway, as a solution, I decided to simply clear the controls in the cells, then dynamically create my own linkbuttons. I would prefer to avoid this if I could only because it creates a little more overhead on the postback.
Dec 31 '12 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Place a break point on that line and find out which index the LinkButton control exists?



-Frinny
Jan 8 '13 #4
yarbrough40
320 Contributor
Thanks, the control exists at index 0. the problem is that there is no way to cast the control to some type of aspx type in order to apply custom attributes to it.
Jan 8 '13 #5
Frinavale
9,735 Recognized Expert Moderator Expert
Oh, I see what you are trying to do.
Hmm...you can't do that.

When it is rendered, does the day have an ID associated with it?

-Frinny
Jan 8 '13 #6
yarbrough40
320 Contributor
yes, e.day.date is there so the solution I have settled on is to just clear out the controls in each day cell then instantiate a new linkbutton using that date. It would be nice to avoid that route simply to keep the overhead down. asp.net as we know is pretty resource heavy in general. It is what it is : )
Jan 8 '13 #7
Frinavale
9,735 Recognized Expert Moderator Expert
You might have to overwrite the controls...

Or you could look into a JavaScript solution that attaches a click event to the "day" since there is an HTML element with an ID for the "day". Unless you meant to say "no, there is no ID associated with the Day".

-Frinny
Jan 8 '13 #8
Frinavale
9,735 Recognized Expert Moderator Expert
It really sounds like you are doing something more than you probably need to. What exactly are you trying to accomplish?

-Frinny
Jan 8 '13 #9
yarbrough40
320 Contributor
I want to add custom javascript to the existing day hyperlink so that onmouseover I can identify that it is truly a click on that hyperlink as opposed to a click on the larger day-cell (I am firing a different event on the cell click).
Jan 8 '13 #10
Frinavale
9,735 Recognized Expert Moderator Expert
Ok, write a JavaScript function that retrieves all of the hyperlinks within your calendar.

I believe the calendar is rendered as a table right?
The table should have an ID and you can use the document.getElementByID() method to retrieve it. Once you have the table, you can use tableVariable.getElementsByTagName() to retrieve all of the hyperlinks within the table.

You can then loop through the hyperlinks and attach a click event to them so that you can set a hidden variable or something in order to indicate that it was the hyperlink clicked, as opposed to the cell.

-Frinny
Jan 8 '13 #11
yarbrough40
320 Contributor
use a JS loop... great idea!
Jan 8 '13 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Kwena Seema via .NET 247 | last post by:
Hi, I'm doing a web app,what i want to achieve is: when i click a specific day on a calender control, it takes me to a specified aspx page. -------------------------------- From: Kwena Seema ...
0
by: Steve Peterson | last post by:
Hi I have a web app running on WinXP Pro which has the OS's operating system's regional settings set to "Spanish - Spain". I have a web app running on this computer that one page has a calender...
2
by: jack | last post by:
Hi, Im creating a attendence project for which im using a callender control .. in this im making the user to click on the button with will enter the current date and time in the database . is it...
3
by: jack | last post by:
Hi im making a scheduler, in house project in which im using a calender control. in this is possible to ger an hover effect (or a color change ) of a cell which i do mouse over on this control . ...
1
by: Jessica Weiner | last post by:
I have an ASP .NET web application and I am using the calender control to display the month view and some events that are scheduled to happen during the month. Whenever the user selects a month,...
0
by: jack | last post by:
Hi all, I this this would be the most common question to most of the professionals out there. but for me its a head ac I am developing in asp.net 2.0 and wanted to use drop down calender...
1
by: Gladie | last post by:
Hi all, Am in need of developing a calender control, In that control, user can select the current date and previous(past) date, Control wont allow the user to select the future dates.. I hope...
1
by: Doug | last post by:
Hi, How do I get a Calender Control popup to appear near the button which activated it, rather than on the other side of the screen? (MS Access 2000)
21
Vkas
by: Vkas | last post by:
i had created my own web calender control!!!! it consist 1} text box (it display's the selected date) 2} button (it hide and show the calender control) 3} calender control (use for the selection...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.