how do I call javascript in asp.net control

I

iHavAQuestion

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>
 
P

PopeDarren

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';")
 
G

George Ter-Saakov

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.ClientID%>'">blablalbla</a>

George.
 
I

iHavAQuestion

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.
 
I

iHavAQuestion

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top