473,289 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

How to access ASP.NET Calendar control from javascript?

Ben
I have a javascript code in the ASP.NET page.
I want to access Calendar control that is inside ASP page and is "run
at server".

I try to use following code but it doesn't work.

<script language="javascript">
function valSubmit()
{
document.getElementById("Calendar1").style.visibil ity =
'visible';
}
</script>

I got following error:

ERROR: Object required

Could anyone give a suggestion?

Thanks,
Ben

May 19 '06 #1
5 10760
The calendar's UNIQUEID might differ on render try :

document.getElementById('<%=Calender1.uniqueid%>') .style.visibility
='visible';

(You might need to modify to make it work)

"Ben" <wu******@yahoo.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
I have a javascript code in the ASP.NET page.
I want to access Calendar control that is inside ASP page and is "run
at server".

I try to use following code but it doesn't work.

<script language="javascript">
function valSubmit()
{
document.getElementById("Calendar1").style.visibil ity =
'visible';
}
</script>

I got following error:

ERROR: Object required

Could anyone give a suggestion?

Thanks,
Ben

May 19 '06 #2
Btw, curious, how did you got the error?
"Ben" <wu******@yahoo.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
I have a javascript code in the ASP.NET page.
I want to access Calendar control that is inside ASP page and is "run
at server".

I try to use following code but it doesn't work.

<script language="javascript">
function valSubmit()
{
document.getElementById("Calendar1").style.visibil ity =
'visible';
}
</script>

I got following error:

ERROR: Object required

Could anyone give a suggestion?

Thanks,
Ben

May 19 '06 #3
Better to use ClientID instead of UniqueID - uniqueId names controls with a
'.' as a seperator instead of a '_'.

"Edwin Knoppert" wrote:
Btw, curious, how did you got the error?
"Ben" <wu******@yahoo.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
I have a javascript code in the ASP.NET page.
I want to access Calendar control that is inside ASP page and is "run
at server".

I try to use following code but it doesn't work.

<script language="javascript">
function valSubmit()
{
document.getElementById("Calendar1").style.visibil ity =
'visible';
}
</script>

I got following error:

ERROR: Object required

Could anyone give a suggestion?

Thanks,
Ben


May 25 '06 #4
Ben
Hi Edwin,

The reason that I want to addess Calendar control in Javascript is
because I want to show and hide Calendar control without refreshing ASP
page.
I have a lot of database controls link to gridviews. Refreshing page
will take a long time.

Thanks,
Ben

Edwin Knoppert wrote:
Btw, curious, how did you got the error?
"Ben" <wu******@yahoo.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
I have a javascript code in the ASP.NET page.
I want to access Calendar control that is inside ASP page and is "run
at server".

I try to use following code but it doesn't work.

<script language="javascript">
function valSubmit()
{
document.getElementById("Calendar1").style.visibil ity =
'visible';
}
</script>

I got following error:

ERROR: Object required

Could anyone give a suggestion?

Thanks,
Ben


Jun 7 '06 #5
Are you sure you're getting the right ID for the Calendar? If it's inside a
container control, it might have a different prefix. Here's a way to get the
ID for sure.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
ClientScript.RegisterClientScriptBlock _
(Me.GetType(), "cal", "function
valSubmit(){document.getElementById('" & _
Calendar1.ClientID & "').style.visibility='hidden';}", True)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Hide Calendar</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:calendar id="Calendar1" runat="server"></asp:calendar>
<br />
<button onclick="valSubmit();return false;">Hide</button></div>
</form>
</body>
</html>
"Ben" <wu******@yahoo.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Hi Edwin,

The reason that I want to addess Calendar control in Javascript is
because I want to show and hide Calendar control without refreshing ASP
page.
I have a lot of database controls link to gridviews. Refreshing page
will take a long time.

Thanks,
Ben

Edwin Knoppert wrote:
Btw, curious, how did you got the error?
"Ben" <wu******@yahoo.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
>I have a javascript code in the ASP.NET page.
> I want to access Calendar control that is inside ASP page and is "run
> at server".
>
> I try to use following code but it doesn't work.
>
> <script language="javascript">
> function valSubmit()
> {
> document.getElementById("Calendar1").style.visibil ity =
> 'visible';
> }
> </script>
>
> I got following error:
>
> ERROR: Object required
>
> Could anyone give a suggestion?
>
> Thanks,
> Ben
>

Jun 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: slawek xxxxx | last post by:
Hello everyone, I have a terrible with Calendar control and I hope someone of you can help me. The problem is following. I have to display a calendar to select date. I have prepared page with...
5
by: Miguel Dias Moura | last post by:
Hello, i am trying to create a .css file with several styles and apply them to the calendar control so i can change the look of: 1. Text Type and Format (Bold, Underline, etc) 2. Background...
0
by: maxrawson | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
7
by: Mike Charney | last post by:
I am trying to use the calendar control in Access (Calendar Control 11.0) I have it working but for only one form. I do not know VB/VBA very well, but how can I open the calendar control, which...
1
by: afr0ninja | last post by:
Hello all, and thank you in advance for your assistance. I'm pretty new to access and I'm trying to teach myself some VBA by using various bits of code I find here and there mixed with my own....
3
by: =?Utf-8?B?UGFycm90?= | last post by:
I applied the following Ajax code in my web page which has a calendar control to keep my page from completely reloading everytime something was changed. <atlas:ScriptManager ID="ScriptManager1"...
7
by: John Kotuby | last post by:
Hi all, I am trying to use a calendar server control which I have ID="Calendar1" in the source code. What I am trying to do is emulate a JavaScript calendar that was being used in an older ASP...
2
by: phill86 | last post by:
Hi I have a calendar control (MS office Access calendar control 11.0) on my form and i want to refresh the form as soon as i have selected the date on the calendar any ideas? Cheers Phill
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.