how do I call javascript in asp.net control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?=

    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="txtDateIssu ed" style="width: 95px; height: 16px"
    value=" mm/dd/yyyy" onfocus="if(thi s.value=='mm/dd/yyyy') this.value='';"
    onblur="if(this .value=='') this.value='mm/dd/yyyy';" />
    <td style="width: 10px" align="justify" >
    <a href="javascrip t:OpenCal('txtD ateIssued');">
    <img alt="" src="Templates/Main/Images/pdate.gif" width="12"
    height="12"></a>
  • PopeDarren@gmail.com

    #2
    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.Attrib utes.Add("onfoc us", "if(this.value= ='mm/dd/
    yyyy') this.value='';" )
    myTxtBox.Attrib utes.Add("onblu r", "if(this.value= ='')
    this.value='mm/dd/yyyy';")

    Comment

    • George Ter-Saakov

      #3
      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="txtDateIssu ed"....>
      <a href="javascrip t:OpenCal('<%=t xtDateIssued.Cl ientID%>'">blab lalbla</a>

      George.


      "iHavAQuest ion" <iHavAQuestion@ discussions.mic rosoft.comwrote in message
      news:FABE3F08-358C-44F4-8176-C6A10A5A2742@mi crosoft.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="txtDateIssu ed" style="width: 95px; height: 16px"
      value=" mm/dd/yyyy" onfocus="if(thi s.value=='mm/dd/yyyy') this.value='';"
      onblur="if(this .value=='') this.value='mm/dd/yyyy';" />
      <td style="width: 10px" align="justify" >
      <a href="javascrip t:OpenCal('txtD ateIssued');">
      <img alt="" src="Templates/Main/Images/pdate.gif" width="12"
      height="12"></a>

      Comment

      • =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?=

        #4
        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:To olkitScriptMana ger
        I also added AjaxControlTool kit.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="txtDateIssu ed"....>
        <a href="javascrip t:OpenCal('<%=t xtDateIssued.Cl ientID%>'">blab lalbla</a>
        >
        George.
        >
        >
        "iHavAQuest ion" <iHavAQuestion@ discussions.mic rosoft.comwrote in message
        news:FABE3F08-358C-44F4-8176-C6A10A5A2742@mi crosoft.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="txtDateIssu ed" style="width: 95px; height: 16px"
        value=" mm/dd/yyyy" onfocus="if(thi s.value=='mm/dd/yyyy') this.value='';"
        onblur="if(this .value=='') this.value='mm/dd/yyyy';" />
        <td style="width: 10px" align="justify" >
        <a href="javascrip t:OpenCal('txtD ateIssued');">
        <img alt="" src="Templates/Main/Images/pdate.gif" width="12"
        height="12"></a>
        >
        >
        >

        Comment

        • =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?=

          #5
          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:To olkitScriptMana ger
          I also added AjaxControlTool kit.dll in the bin directory.


          "PopeDarren@gma il.com" wrote:
          Weeeeelll... in the page's load event you could add the attributes
          like this:
          >
          myTxtBox.Attrib utes.Add("onfoc us", "if(this.value= ='mm/dd/
          yyyy') this.value='';" )
          myTxtBox.Attrib utes.Add("onblu r", "if(this.value= ='')
          this.value='mm/dd/yyyy';")
          >

          Comment

          Working...