Client side action to cause postback

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

  1. #1

    Default Re: Client side action to cause postback

    Hi

    As soon as anything is added to the textbox set radio checked and submit?

    myBox.Attributes.Add("onkeypress","if(this.value != '')
    {this.form.myRadio.checked=true; this.form.submit()}");

    Note if radiobtn list then you have to use index
    this.form.myRadio[INDEX].checked = true;

    Is checkbox not a better choice than radio

    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Internet Client & Controls MVP
    ==============================
    "Antonio Maciel" <antmac@consys.com> wrote in message
    news:e%23o0596RDHA.2432@TK2MSFTNGP10.phx.gbl...
    > Hi.
    >
    > I have a client-side script associated with the onKeyPress event of a
    > textbox. When my user types any character on the textbox I need to check a
    > radiobutton and causes a postback to the server. I tried this expression
    > txtPostalCode.Atributes.Add("onKeyPress",
    > "document.Form1.rbSelection.checked=true; return true;"). The radiobutton
    is
    > checked but no postback occurs. How can I raise a postback from this code?
    >
    > Thanks,
    >
    > Antonio Maciel
    >
    >

    Vidar Petursson Guest

  2. Similar Questions and Discussions

    1. custom web control +client-side javascript + postback
      Hello, I am trying to create a new Web Control (ASP.NET 1.1) that contains among other textboxes. The content of these textboxes (runat=server)...
    2. flashcom: client side cant access server side
      hi all, i hav install the flash com on the PC. It work well, on the server PC, i can access and log in to the 'chat room'.. however, if im...
    3. Controls with a client side onLoad function or seting a cursor server side
      Is there any way to create a web control that calls a client side onLoad function? Its diffucilt since you are not able to access the form or...
    4. Client side and server side scripting problem
      Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve...
    5. button evet ---- server side - client side ???
      I want to use button. My question is that How can use server side and client site event at the same time. That is: I want to use button : when...
  3. #2

    Default Re: Client side action to cause postback

    Hi Vidar.

    Your code works, but as soon as the form is submited the value of the
    textbox is lost. Do you have any idea on why?

    Thanks,

    Antonio Maciel.

    "Vidar Petursson" <theking@icysoft.com> wrote in message
    news:%23XxE0F7RDHA.2188@TK2MSFTNGP10.phx.gbl...
    > Hi
    >
    > As soon as anything is added to the textbox set radio checked and submit?
    >
    > myBox.Attributes.Add("onkeypress","if(this.value != '')
    > {this.form.myRadio.checked=true; this.form.submit()}");
    >
    > Note if radiobtn list then you have to use index
    > this.form.myRadio[INDEX].checked = true;
    >
    > Is checkbox not a better choice than radio
    >
    > --
    > Best Regards
    > Vidar Petursson
    > ==============================
    > Microsoft Internet Client & Controls MVP
    > ==============================
    > "Antonio Maciel" <antmac@consys.com> wrote in message
    > news:e%23o0596RDHA.2432@TK2MSFTNGP10.phx.gbl...
    > > Hi.
    > >
    > > I have a client-side script associated with the onKeyPress event of a
    > > textbox. When my user types any character on the textbox I need to check
    a
    > > radiobutton and causes a postback to the server. I tried this expression
    > > txtPostalCode.Atributes.Add("onKeyPress",
    > > "document.Form1.rbSelection.checked=true; return true;"). The
    radiobutton
    > is
    > > checked but no postback occurs. How can I raise a postback from this
    code?
    > >
    > > Thanks,
    > >
    > > Antonio Maciel
    > >
    > >
    >
    >

    Antonio Maciel Guest

  4. #3

    Default Re: Client side action to cause postback

    Hi

    ahh.... use onkeyup instead of onkeypress


    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Internet Client & Controls MVP
    ==============================
    "Antonio Maciel" <antmac@consys.com> wrote in message
    news:eYIf3l7RDHA.3796@tk2msftngp13.phx.gbl...
    > Hi Vidar.
    >
    > Your code works, but as soon as the form is submited the value of the
    > textbox is lost. Do you have any idea on why?
    >
    > Thanks,
    >
    > Antonio Maciel.
    >
    > "Vidar Petursson" <theking@icysoft.com> wrote in message
    > news:%23XxE0F7RDHA.2188@TK2MSFTNGP10.phx.gbl...
    > > Hi
    > >
    > > As soon as anything is added to the textbox set radio checked and
    submit?
    > >
    > > myBox.Attributes.Add("onkeypress","if(this.value != '')
    > > {this.form.myRadio.checked=true; this.form.submit()}");
    > >
    > > Note if radiobtn list then you have to use index
    > > this.form.myRadio[INDEX].checked = true;
    > >
    > > Is checkbox not a better choice than radio
    > >
    > > --
    > > Best Regards
    > > Vidar Petursson
    > > ==============================
    > > Microsoft Internet Client & Controls MVP
    > > ==============================
    > > "Antonio Maciel" <antmac@consys.com> wrote in message
    > > news:e%23o0596RDHA.2432@TK2MSFTNGP10.phx.gbl...
    > > > Hi.
    > > >
    > > > I have a client-side script associated with the onKeyPress event of a
    > > > textbox. When my user types any character on the textbox I need to
    check
    > a
    > > > radiobutton and causes a postback to the server. I tried this
    expression
    > > > txtPostalCode.Atributes.Add("onKeyPress",
    > > > "document.Form1.rbSelection.checked=true; return true;"). The
    > radiobutton
    > > is
    > > > checked but no postback occurs. How can I raise a postback from this
    > code?
    > > >
    > > > Thanks,
    > > >
    > > > Antonio Maciel
    > > >
    > > >
    > >
    > >
    >
    >

    Vidar Petursson Guest

  5. #4

    Default Re: Client side action to cause postback

    why not just set the AutoPostback=True on the radio button?


    "Vidar Petursson" <theking@icysoft.com> wrote in message
    news:u0RLOw7RDHA.2460@TK2MSFTNGP10.phx.gbl...
    > Hi
    >
    > ahh.... use onkeyup instead of onkeypress
    >
    >
    > --
    > Best Regards
    > Vidar Petursson
    > ==============================
    > Microsoft Internet Client & Controls MVP
    > ==============================
    > "Antonio Maciel" <antmac@consys.com> wrote in message
    > news:eYIf3l7RDHA.3796@tk2msftngp13.phx.gbl...
    > > Hi Vidar.
    > >
    > > Your code works, but as soon as the form is submited the value of the
    > > textbox is lost. Do you have any idea on why?
    > >
    > > Thanks,
    > >
    > > Antonio Maciel.
    > >
    > > "Vidar Petursson" <theking@icysoft.com> wrote in message
    > > news:%23XxE0F7RDHA.2188@TK2MSFTNGP10.phx.gbl...
    > > > Hi
    > > >
    > > > As soon as anything is added to the textbox set radio checked and
    > submit?
    > > >
    > > > myBox.Attributes.Add("onkeypress","if(this.value != '')
    > > > {this.form.myRadio.checked=true; this.form.submit()}");
    > > >
    > > > Note if radiobtn list then you have to use index
    > > > this.form.myRadio[INDEX].checked = true;
    > > >
    > > > Is checkbox not a better choice than radio
    > > >
    > > > --
    > > > Best Regards
    > > > Vidar Petursson
    > > > ==============================
    > > > Microsoft Internet Client & Controls MVP
    > > > ==============================
    > > > "Antonio Maciel" <antmac@consys.com> wrote in message
    > > > news:e%23o0596RDHA.2432@TK2MSFTNGP10.phx.gbl...
    > > > > Hi.
    > > > >
    > > > > I have a client-side script associated with the onKeyPress event of
    a
    > > > > textbox. When my user types any character on the textbox I need to
    > check
    > > a
    > > > > radiobutton and causes a postback to the server. I tried this
    > expression
    > > > > txtPostalCode.Atributes.Add("onKeyPress",
    > > > > "document.Form1.rbSelection.checked=true; return true;"). The
    > > radiobutton
    > > > is
    > > > > checked but no postback occurs. How can I raise a postback from this
    > > code?
    > > > >
    > > > > Thanks,
    > > > >
    > > > > Antonio Maciel
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    David Waz... 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