How do I stop this javascript from being emitted?

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default How do I stop this javascript from being emitted?

    Hi all,

    I have a fairly basic page with some text boxes, validators and submit
    buttons. I have "EnableClientScript" set to false for all the
    validators and "enableEventValidation" set to false in the pages
    section of the web.config file. Whenever a validator is present on the
    page, the following javascript is emitted:

    <script type="text/javascript">
    <!--
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {
    theForm = document.aspnetForm;
    }
    function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
    }
    }
    // -->
    </script>

    <script
    src="/WebResource.axd?d=yCWeX6Nxz-J5KFaiENoCPA2&amp;t=632938428474843750"
    type="text/javascript"></script>

    If I remove the validators, it's not emitted. I've decoded the
    viewstate and it contains the following items:

    -1017253366d
    __ControlsRequirePostBackKey__
    ctl00$cphPage$ctl01
    ctl00$cphPage$ctl02R

    Does anyone know what I can do to stop the javascript being emitted?

    Thanks,

    Paul

    paul.hester@gmail.com Guest

  2. Similar Questions and Discussions

    1. STOP=Save The Opticles People! ... Stop Flashs flashing!
      :| WHEN will they ever learn, our eyes are not to be played with. Imagin putting on a blindfold on for 1 - 24hr period & TRY to go about there...
    2. Audio doesn't stop with Javascript StopPlay()
      We are using JavaScript Play() and StopPlay() functions to control the playback of Flash files embedded in a web page in Mozilla. We also embed the...
    3. Replication - ASNCMD "DBNAME" STOP does not stop Capure
      I am running DB2 version 7.2, when I execute ASNCMD dbname STOP. 8 out of ten times Capture will bring itself down. I need this to work 100% of...
    4. Client Script emitted from a Repeater Item Control
      I'm using a repeater to show the rows in a data table. I'd like the have a link button beside each row that removes the record, firing a client...
  3. #2

    Default Re: How do I stop this javascript from being emitted?

    I think it is the Button causing it to be registered when there are
    validators in the same validation group with it.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]

    <paul.hester@gmail.com> wrote in message
    news:1158275205.462089.28820@k70g2000cwa.googlegro ups.com...
    > Hi all,
    >
    > I have a fairly basic page with some text boxes, validators and submit
    > buttons. I have "EnableClientScript" set to false for all the
    > validators and "enableEventValidation" set to false in the pages
    > section of the web.config file. Whenever a validator is present on the
    > page, the following javascript is emitted:
    >
    > <script type="text/javascript">
    > <!--
    > var theForm = document.forms['aspnetForm'];
    > if (!theForm) {
    > theForm = document.aspnetForm;
    > }
    > function __doPostBack(eventTarget, eventArgument) {
    > if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    > theForm.__EVENTTARGET.value = eventTarget;
    > theForm.__EVENTARGUMENT.value = eventArgument;
    > theForm.submit();
    > }
    > }
    > // -->
    > </script>
    >
    > <script
    > src="/WebResource.axd?d=yCWeX6Nxz-J5KFaiENoCPA2&amp;t=632938428474843750"
    > type="text/javascript"></script>
    >
    > If I remove the validators, it's not emitted. I've decoded the
    > viewstate and it contains the following items:
    >
    > -1017253366d
    > __ControlsRequirePostBackKey__
    > ctl00$cphPage$ctl01
    > ctl00$cphPage$ctl02R
    >
    > Does anyone know what I can do to stop the javascript being emitted?
    >
    > Thanks,
    >
    > Paul
    >

    Teemu Keiski Guest

  4. #3

    Default Re: How do I stop this javascript from being emitted?

    Hi Teemu,

    Thanks for getting back to me. Do you know how I can stop this from
    happening?

    Thanks,

    Paul

    Teemu Keiski wrote:
    > I think it is the Button causing it to be registered when there are
    > validators in the same validation group with it.
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > [url]http://blogs.aspadvice.com/joteke[/url]
    >
    > <paul.hester@gmail.com> wrote in message
    > news:1158275205.462089.28820@k70g2000cwa.googlegro ups.com...
    > > Hi all,
    > >
    > > I have a fairly basic page with some text boxes, validators and submit
    > > buttons. I have "EnableClientScript" set to false for all the
    > > validators and "enableEventValidation" set to false in the pages
    > > section of the web.config file. Whenever a validator is present on the
    > > page, the following javascript is emitted:
    > >
    > > <script type="text/javascript">
    > > <!--
    > > var theForm = document.forms['aspnetForm'];
    > > if (!theForm) {
    > > theForm = document.aspnetForm;
    > > }
    > > function __doPostBack(eventTarget, eventArgument) {
    > > if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    > > theForm.__EVENTTARGET.value = eventTarget;
    > > theForm.__EVENTARGUMENT.value = eventArgument;
    > > theForm.submit();
    > > }
    > > }
    > > // -->
    > > </script>
    > >
    > > <script
    > > src="/WebResource.axd?d=yCWeX6Nxz-J5KFaiENoCPA2&amp;t=632938428474843750"
    > > type="text/javascript"></script>
    > >
    > > If I remove the validators, it's not emitted. I've decoded the
    > > viewstate and it contains the following items:
    > >
    > > -1017253366d
    > > __ControlsRequirePostBackKey__
    > > ctl00$cphPage$ctl01
    > > ctl00$cphPage$ctl02R
    > >
    > > Does anyone know what I can do to stop the javascript being emitted?
    > >
    > > Thanks,
    > >
    > > Paul
    > >
    paul.hester@gmail.com Guest

  5. #4

    Default Re: How do I stop this javascript from being emitted?

    Set CausesValidation="False" for the Button in the same validation group.
    You just need to call Page.Validate on server manually before you can access
    Page.IsValid property.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]

    <paul.hester@gmail.com> wrote in message
    news:1158444860.430509.158590@i42g2000cwa.googlegr oups.com...
    > Hi Teemu,
    >
    > Thanks for getting back to me. Do you know how I can stop this from
    > happening?
    >
    > Thanks,
    >
    > Paul
    >
    > Teemu Keiski wrote:
    >> I think it is the Button causing it to be registered when there are
    >> validators in the same validation group with it.
    >>
    >> --
    >> Teemu Keiski
    >> ASP.NET MVP, AspInsider
    >> Finland, EU
    >> [url]http://blogs.aspadvice.com/joteke[/url]
    >>
    >> <paul.hester@gmail.com> wrote in message
    >> news:1158275205.462089.28820@k70g2000cwa.googlegro ups.com...
    >> > Hi all,
    >> >
    >> > I have a fairly basic page with some text boxes, validators and submit
    >> > buttons. I have "EnableClientScript" set to false for all the
    >> > validators and "enableEventValidation" set to false in the pages
    >> > section of the web.config file. Whenever a validator is present on the
    >> > page, the following javascript is emitted:
    >> >
    >> > <script type="text/javascript">
    >> > <!--
    >> > var theForm = document.forms['aspnetForm'];
    >> > if (!theForm) {
    >> > theForm = document.aspnetForm;
    >> > }
    >> > function __doPostBack(eventTarget, eventArgument) {
    >> > if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    >> > theForm.__EVENTTARGET.value = eventTarget;
    >> > theForm.__EVENTARGUMENT.value = eventArgument;
    >> > theForm.submit();
    >> > }
    >> > }
    >> > // -->
    >> > </script>
    >> >
    >> > <script
    >> > src="/WebResource.axd?d=yCWeX6Nxz-J5KFaiENoCPA2&amp;t=632938428474843750"
    >> > type="text/javascript"></script>
    >> >
    >> > If I remove the validators, it's not emitted. I've decoded the
    >> > viewstate and it contains the following items:
    >> >
    >> > -1017253366d
    >> > __ControlsRequirePostBackKey__
    >> > ctl00$cphPage$ctl01
    >> > ctl00$cphPage$ctl02R
    >> >
    >> > Does anyone know what I can do to stop the javascript being emitted?
    >> >
    >> > Thanks,
    >> >
    >> > Paul
    >> >
    >

    Teemu Keiski Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139