Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > asp.net - Client side script not recognized for the usercontrol

Reply
Thread Tools

asp.net - Client side script not recognized for the usercontrol

 
 
sara_23apr sara_23apr is offline
Junior Member
Join Date: Sep 2006
Posts: 3
 
      09-17-2006
Hello Everybody

I have a date text box im my asp.net page, I am using regular expression validator to enter the date in the format dd-mm-yyyy .

on blur event of the textbox (i am explicitly calling that onblur event in page load.) i am calling javascript to change the format of date to dd-MMM-yyyy

(i.e the user enter 01/01/2006....onblur it is changed to 01/Jan/2006)

This is working fine in page level.

But I want to create a "user control" for this . I created same thing using user control. But it is not working.

In load event of the user control , i used this script tag to recognize the javascript.

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "MyScript", "document.getElementById('Me.ChosenDate.ClientID') .value = str2", True)

But it is not working. It does not give error but does not work either


I also tried to create a .js file and call it in Page load....even this did not help
Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "MyScript", "datecode.js", True)

Please help

Have a great day ahead
Regards
Sara
 
Reply With Quote
 
 
 
 
Raja Raja is offline
Junior Member
Join Date: Sep 2006
Posts: 1
 
      09-27-2006
Dear Sara,

If ur using Server Controls in the user control then just try this Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "MyScript", "document.all['Me.ChosenDate.ClientID').value = str2", True)

if this doesnot work out

in the load event of the use control u need to add a attribute "onblure" key to the text box of the user control with the value as javascript function that u used for the first ( "on blur event of the textbox (i am explicitly calling that onblur event in page load.) i am calling javascript to change the format of date to dd-MMM-yyyy ")

hope u solve ur problem.

Regards.
Raja
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
textbox not recognized in client side Claudia Fong ASP .Net 4 11-30-2007 02:53 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
Server-side script with input parameter from Client-side script Magnus Blomberg ASP .Net 3 04-14-2005 12:21 PM
PBM: MSXML4 typelib constants not recognized in server-side script Vince C. ASP General 12 01-15-2004 06:48 PM
Referencing a subcontrol of a UserControl within client-side script. Mark Friedman ASP .Net Web Controls 0 07-09-2003 08:24 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57