473,395 Members | 1,484 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,395 software developers and data experts.

How can I stop my Calendar control from firing the form validation events?

How can I stop my Calendar control from firing the form validation
events?

I have a form containing several controls which have several
validation controls each.

One control is a TextBox where the date is entered. Connected to this
is an image button which launches a popup window containing a calendar
control. The selected value from the calendar is then fed back to the
TextBox.

<asp:TextBox ID="txtDate" runat="server" CausesValidation="true" />
<input ID="lnkDatePopUp" class="imgCalendar" type="image"
onclick="window.open('DatePopUp.aspx?
FormItemName=ctl00$ContentPlaceHolder
$txtDate','cal','width=250,height=225,left=270,top =180')"
Width="100px">

When this happens, the validation warnings are shown for controls
without values. How can I stop this?

For instance:
* can that be done with AJAX?
* should I look for a pure javascript date picker?
* is there are way to achieve my objective by putting the Calendar
control on the same page? (inside a DIV)
The server code for the popup page is shown below:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Administration_DatePopUp : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
hid.Value =
((string)Request.QueryString["FormItemName"]).ToString();
}
protected void Calendar1_SelectionChanged(object sender, EventArgs
e)
{
// Define the name and type of the client scripts on the page.
String csname2 = "CalSelectionChange";
Type cstype = this.GetType();

// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;

// Check to see if the client script is already registered.
if (!cs.IsClientScriptBlockRegistered(cstype, csname2))
{
string strScript = "<script>window.opener.document.forms(0)." +
hid.Value + ".value = '" +
Calendar1.SelectedDate.ToString("dd/MM/yyyy") +
"';self.close();</script>";
cs.RegisterClientScriptBlock(cstype, csname2, strScript, false);
}
}
}

Mar 8 '07 #1
3 2150
"mark4asp" <ma******@gmail.comwrote in message
news:11**********************@8g2000cwh.googlegrou ps.com...
* should I look for a pure javascript date picker?
That's certainly my preferred option...
Mar 8 '07 #2
On 8 Mar, 14:59, "Mark Rae" <m...@markNOSPAMrae.comwrote:
"mark4asp" <mark4...@gmail.comwrote in message

news:11**********************@8g2000cwh.googlegrou ps.com...
* should I look for a pure javascript date picker?

That's certainly my preferred option...
Mark - there's a new AJAX control which looks very swanky to me:

<http://ajax.asp.net/ajaxtoolkit/Calendar/Calendar.aspx>

I will have to use that one - I can't imagine a javascript control
being anything like as nice as that!

I downloaded that same toolkit weeks ago - so the new calendar
must'vwe apeared after 20 Feb 2007.
Mar 8 '07 #3
"mark4asp" <ma******@gmail.comwrote in message
news:11*********************@p10g2000cwp.googlegro ups.com...
* should I look for a pure javascript date picker?

That's certainly my preferred option...

Mark - there's a new AJAX control which looks very swanky to me:
Yes indeed...
I will have to use that one - I can't imagine a javascript control
being anything like as nice as that!
You'd be surprised...

Don't forget that every scroll and click fires a round-trip to the server
and back - a callback is (usually) much less costly than a postback, and
doesn't redraw the entire page obviously, but it's still a hit on the server
which, if you can avoid it, is almost always a good thing to do...
Mar 8 '07 #4

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

Similar topics

1
by: Lumpierbritches | last post by:
I have a Calendar control (me.mycal) and a subform sbfAppointments, with child/parent links from Parent/MyCal (ActiveX) to Child/ApptDate in the subform sbfAppointments. I would like to be able...
8
by: Shyguy | last post by:
Is it possible to create a calendar that shows previous input data and also allows for input of new data?
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...
2
by: ~~~ .NET Ed ~~~ | last post by:
I have a problem (don't we all?). I have a web form with multiple modules, some of these modules have an ASP.NET (server run) button. OK, now I have UserControlX which has one such button (say...
1
by: Ahmet Gunes | last post by:
Hi all, I check whether session is alive in Page_Load. If session is not alive then I want to navigate to another page, most probably the login page. But when a control, a button for...
5
by: Richard Brown | last post by:
Ok, I've been looking through the .NET SDK docs and stuff. I'm wondering if you can provide a control extender that does generic validation or functionality just by dropping it on the form. For...
7
by: Denise | last post by:
I just realized the DataTable_RowChanging events were firing when I called Fill method of the DataAdapter! It fires TWICE for each row loaded. I thought these were only supposed to be called when...
1
by: Rajani | last post by:
Hi, I have designed a form which process database Insert, edit and Delete(datagrid). I input userid,password and privilege in textboxes which has validation controls to verify data keyed in....
2
by: Rajani | last post by:
Hi, I have designed a form which process database Insert, edit and Delete(datagrid). I input userid,password and privilege in textboxes which has validation controls to verify data keyed in....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.