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

how do I call javascript in asp.net control

Sir,

I have a ASP cotrol text box and a image button, on click of which I call a
javascript(pop up calender) and the below code works fine

What if i have to achive the same using ASP.NET control
<asp:Text box>.....</asp:Text box>

Can any one please help me out.


CODE
------
<input type="text" id="txtDateIssued" style="width: 95px; height: 16px"
value=" mm/dd/yyyy" onfocus="if(this.value=='mm/dd/yyyy') this.value='';"
onblur="if(this.value=='') this.value='mm/dd/yyyy';" />
<td style="width: 10px" align="justify">
<a href="javascript:OpenCal('txtDateIssued');">
<img alt="" src="Templates/Main/Images/pdate.gif" width="12"
height="12"></a>
Apr 7 '08 #1
4 3662
Weeeeelll... in the page's load event you could add the attributes
like this:

myTxtBox.Attributes.Add("onfocus", "if(this.value=='mm/dd/
yyyy') this.value='';")
myTxtBox.Attributes.Add("onblur", "if(this.value=='')
this.value='mm/dd/yyyy';")
Apr 7 '08 #2
What is the exact problem you having? Cause your question is to vague...

I suspect you ahving problem with control id? then do something like

<asp:textbox id="txtDateIssued"....>
<a href="javascript:OpenCal('<%=txtDateIssued.ClientI D%>'">blablalbla</a>

George.
"iHavAQuestion" <iH***********@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
Sir,

I have a ASP cotrol text box and a image button, on click of which I call
a
javascript(pop up calender) and the below code works fine

What if i have to achive the same using ASP.NET control
<asp:Text box>.....</asp:Text box>

Can any one please help me out.


CODE
------
<input type="text" id="txtDateIssued" style="width: 95px; height: 16px"
value=" mm/dd/yyyy" onfocus="if(this.value=='mm/dd/yyyy') this.value='';"
onblur="if(this.value=='') this.value='mm/dd/yyyy';" />
<td style="width: 10px" align="justify">
<a href="javascript:OpenCal('txtDateIssued');">
<img alt="" src="Templates/Main/Images/pdate.gif" width="12"
height="12"></a>

Apr 8 '08 #3
Thanks George now it works..

Now I have one more issue.
I have downloaded Ajax frame work and in the toolbox I am getting AJAX
Extention in which i find the Script manager.
Bit,in the design form I am not getting this part of the tag..
<ajaxToolkit:ToolkitScriptManager
I also added AjaxControlToolkit.dll in the bin directory.

"George Ter-Saakov" wrote:
What is the exact problem you having? Cause your question is to vague...

I suspect you ahving problem with control id? then do something like

<asp:textbox id="txtDateIssued"....>
<a href="javascript:OpenCal('<%=txtDateIssued.ClientI D%>'">blablalbla</a>

George.
"iHavAQuestion" <iH***********@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
Sir,

I have a ASP cotrol text box and a image button, on click of which I call
a
javascript(pop up calender) and the below code works fine

What if i have to achive the same using ASP.NET control
<asp:Text box>.....</asp:Text box>

Can any one please help me out.


CODE
------
<input type="text" id="txtDateIssued" style="width: 95px; height: 16px"
value=" mm/dd/yyyy" onfocus="if(this.value=='mm/dd/yyyy') this.value='';"
onblur="if(this.value=='') this.value='mm/dd/yyyy';" />
<td style="width: 10px" align="justify">
<a href="javascript:OpenCal('txtDateIssued');">
<img alt="" src="Templates/Main/Images/pdate.gif" width="12"
height="12"></a>


Jun 27 '08 #4
Thank U Sir,
It works ::))

Now I have one more issue.
I have downloaded Ajax frame work and in the toolbox I am getting AJAX
Extention in which i find the Script manager.
Bit,in the design form I am not getting this part of the tag..
<ajaxToolkit:ToolkitScriptManager
I also added AjaxControlToolkit.dll in the bin directory.
"Po********@gmail.com" wrote:
Weeeeelll... in the page's load event you could add the attributes
like this:

myTxtBox.Attributes.Add("onfocus", "if(this.value=='mm/dd/
yyyy') this.value='';")
myTxtBox.Attributes.Add("onblur", "if(this.value=='')
this.value='mm/dd/yyyy';")
Jun 27 '08 #5

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

Similar topics

5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
1
by: Nevyn Twyll | last post by:
I have a DataList; in the DataList's , I have a LinkButton and a few listboxes. When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls. Then I...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
4
by: Mike Moore | last post by:
Can an asp.net button that is a server side control call a client side java function when the button is clicked? If so, please provide example.....thanks.,
10
by: Daniel | last post by:
Hi all, Have any ideas for the above question? for example, in pageA, i call pageB's buttonA.visible=false. thank you in advance. best regards, GL
1
by: john conwell | last post by:
I'm using the Browser control to display html that my application generates. Some times i want a javascript to run when the html gets displayed in the browser control, and sometimes i dont. Is...
3
by: anadimpa | last post by:
Hello all I build a javascript function string in the code behind and register it in the Page_Load of my User Control. I do this because I build the javascript based on some variables that are...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.