getting an error javascript:_dopostback('caldate','2285') in popup calendar

Hi.

I am getting an error for a popup calendar as javascript:_dopostback('caldate','2285') when I try to select date from calendar. The code is in asp.net and .aspx.vb file of calendar control contains following code.

Protected

Sub Change_Date(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim strScript As String = "<script>window.opener.document.forms(0)." + control.Value + ".value = '"

strScript += calDate.SelectedDate.ToString("MM/dd/yyyy")

strScript += "';self.close()"

strScript += "</" + "script>"

RegisterClientScriptBlock("anything", strScript)

End Sub.

Will anybody pls tell me why I get this error.

 

0
sonalikate
7/20/2006 6:15:22 AM
asp.net.client-side 24353 articles. 1 followers. Follow

3 Replies
773 Views

Similar Articles

[PageSpeed] 2

Without knowing the error message and line it involves, its hard to say. Here are a few things that could help:

1. Make sure the <script> tag is <script language='javascript'>.

2. See forms(0)? Switch to forms[0]. Its the official javascript syntax. While IE doesn't mind the parenthesis for an array, all other browsers don't handle it.

3. A common errors users make is that when an ID is used in the client-side, they use the same value as the ID property of the server side control. You should always use the ClientID property on the server side control. I don't see this in your scripts and while the doPostback has an ID ('caldate'), its generated by the calendar code, so its correct.

4. There is a good article on writing this kind of popup calendar: http://aspnet.4guysfromrolla.com/articles/030202-1.aspx

I first used that article too, but since then, I learned that the popup calendar into a separate window design had some really frustrating problems:
1. Popup blockers could stop it.
2. The window doesn't float. So the user can accidentally click on another window and send the calendar behind the browser window.
3. Difficult to size it properly because browsers calculate the size of a table differently and the number of weeks changes between 4 and 6 rows.
4. Difficult to position near the toggle button.

So, like many people, I rewote the whole thing, abandoning the Microsoft Calendar control for one of my own that uses javascript to update (no post backs). This allows me to popup the calendar in the same window using absolutely positioned <DIV> tags. If you are trying to build a good UI on your site, consider using a third party DateTextBox with popup calendar. There are a lot since ASP.NET has been around for so long. Mine is Peter's Date Package. Others can be found at this site's Control Gallery, www.123aspx.com, and www.411asp.net. In fact, you will find a rich variety of controls with many good ideas and field tested for ASP.NET at these sites.


--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
www.PeterBlum.com
0
PLBlum
7/20/2006 5:32:35 PM

replace line -

RegisterClientScriptBlock("anything", strScript)

 with

If (Not IsStartupScriptRegistered("clientScript")) Then

Page.RegisterStartupScript("clientScript", strscript)

End If

bye it will work

from -india

0
harminder
12/27/2007 10:48:20 AM

harminder singh,

Why are you answering a post that is over a year and a half old? Also your code does absolutely nothing different than the original poster's did.

NC...

 

0
NC01
12/27/2007 1:14:34 PM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

error in ''%'' operator
hi... friends    i got this error (Syntax error: Missing operand after ''%'' operator)below statement. dtBtnScr.DefaultView.RowFilter = "LOCATION_CITY'" + txtCity.Text.Trim() + "%'AND LOCATION_STATE '" + ddlState.SelectedValue + "%'AND UNIT_ID'" + txtUnitCode + "%'AND UNIT_NAME '" + txtUnitName.Text.Trim() + "%'";   thnax friends It thinks you are trying to use the modulo operator: %. Look at the RowFilter string after you build it ...you should see the prob...

'or' or 'union'
Hello I was just wondering, in general what is better to use, an 'or' clause in a select or a 'union' to join two selects together. Do both statements create work tables? Many thanks Alex I think OR will be better than union. because suppose u have 3 tables and using OR u can join table a and table b and table c so each table will have only one read. but using union you will join table a and table b and in another query of union u will use table (a or b) and table c so ur one read is more in union . Ramdas Alex Cheung wrote: > Hello > >...

'b'..'a'
Hello. I'm using defferent 5.6.0's for Win32. I wonder wheter following behaviour is intentional or not: d:\>perl -e "print 'b'..'c'" bc d:\>perl -e "print 'b'..'a'" bcdefghijklmnopqrstuvwxyz I expected empty list in latter case, like in perl -e "print 'bb'..'a'" <!ENTITY Vadim REALLIFE "Vadim V.Konovalov, St.Petersburg, Russia"> &Vadim; On Wed, Sep 20, 2000 at 03:14:41PM +0400, Konovalov, Vadim wrote: > Hello. > > I'm using defferent 5.6.0'...

'IN' Clause or 'OR'
Hello, [1]: select * from TABLEA where COL1 IN('value1','value2''valu3'....) [2]:select * from TABLEA where COL1 = 'value1' OR COL1= 'value2' OR COL1='valu3'. TABLEA is a huge table and it has non-clustered index on COL1. Among the above 2 queries, which query will give me the better performance or fast response and WHY? What is the difference between 'IN' and 'OR' clauses as for as Sybase Optimization is concerned. Which is the better one to be used on huge tables. Thanks. Mac An IN list is treated ...

'To', 'CC', & 'BCC'
Name: Dick Tracy Email: philipdottracyatoptusnetdotcomdotau Product: Thunderbird Summary: 'To', 'CC', & 'BCC' Comments: I have just started using Thunderbird and while I find it quite excellent- I suggest having a button to add addressees to 'BCC' as well. Currently each 'BCC' addressee has to be selected manually. I send e-mail to quite a number of people at a time and I do not wish to readily spread others addresses easily. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0....

EXEC sp_msforeachtable 'sp_spaceused ''?'''
What does the following SQL code mean?  EXEC sp_msforeachtable 'sp_spaceused ''?'''Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". JohanNL:sp_msforeachtable This is the name of the SP that resides in the master database.  This SP executes one or more commands for a table. JohanNL:sp_spaceused This is the command that you want to run for each of the tables residing in your current database.  As you might have understood so far, that this is again a...

'Value' should be between 'minimum' and 'maximum'.
I'm attempting to invoke with parameters:  Dim thing2 As New mydelsubPBStep(AddressOf pbStep) Me.Invoke(thing2, "setMax", dt.Rows.Count)      <---- this is where the error occurs   the delegate looks like this: Private Delegate Sub mydelsubPBStep(ByVal mode As String, ByVal value As Integer)   the function it's calling looks like this:Private Sub pbStep(ByVal mode As String, ByVal value As Integer) Select Case mode.ToLower Case "clear" ProgressBar1.Value = 0 Case "step" ProgressBar1.PerformStep() L...

'Error msg:'Else' must be preceded by a matching 'If' or 'ElseIf'.
iHi to all I trying to build a form for authontication ,with password and login encryption,and this is the deafault page and I Just have a silly syntax error : 'Else' must be preceded by a matching 'If' or 'ElseIf'. my code is this <% Response.CacheControl= "no-cache" Response.AddHeader ("pragma","no-cache") Response.Expires=-1 If session("UID")="" Then Response.redirect ("Logon.aspx") Response.End Else Response.write"You have logged on as " & sess...

Web resources about - getting an error javascript:_dopostback('caldate','2285') in popup calendar - asp.net.client-side

Resources last updated: 12/25/2015 7:38:00 PM