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>
iHavAQuestion [ Di, 08 April 2008 00:36 ] [ ID #1937703 ]

Re: how do I call javascript in asp.net control

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';")
PopeDarren [ Di, 08 April 2008 00:48 ] [ ID #1937706 ]

Re: how do I call javascript in asp.net control

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"....>
'">blablalbla

George.


"iHavAQuestion" <iHavAQuestion [at] discussions.microsoft.com> wrote in message
news:FABE3F08-358C-44F4-8176-C6A10A5A2742 [at] microsoft.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>
George Ter-Saakov [ Di, 08 April 2008 13:57 ] [ ID #1937743 ]

Re: how do I call javascript in asp.net control

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"....>
> '">blablalbla
>
> George.
>
>
> "iHavAQuestion" <iHavAQuestion [at] discussions.microsoft.com> wrote in message
> news:FABE3F08-358C-44F4-8176-C6A10A5A2742 [at] microsoft.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>
>
>
>
iHavAQuestion [ Fr, 11 April 2008 17:17 ] [ ID #1940197 ]

Re: how do I call javascript in asp.net control

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.


"PopeDarren [at] 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';")
>
iHavAQuestion [ Fr, 11 April 2008 17:53 ] [ ID #1940204 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » how do I call javascript in asp.net control

Vorheriges Thema: Web application
Nächstes Thema: Using smartNavigation on non PC devices