3+ basic questions for asp:RadioButton, related to ViewState, life cycle, javascript

Discussion in 'ASP .Net' started by Ryan Liu, Mar 27, 2009.

  1. Ryan Liu

    Ryan Liu Guest

    Just curious, why, for instance

    <asp:RadioButton runat="server"> or <intput type="radio" runat="server"
    disabled="disabled"> will not post "Checked" state back if initially they
    are disabled, either disabled in code behind or mark up.

    I mointor http post string, actually the information is available.

    Also <asp:Button> 's Text property is also not post back if I changed it on
    client side using javascript.

    ================
    This leads me think about a more general question, for a user input control,
    in asp.net life cycle,
    when does it assign the server control's property with (old) value found in
    view state, and
    when does the same property be assigned with new value in Request.Params
    (user type in input), and overwrite property value got from view state,
    and I assume then update viewstate with new values from user input?

    I read MSDN online, it only mention load viewstate and control state, does
    not mention when to load user input.

    And on server side, does it treat user type in input same as the value
    modified by client javascript? But of couse, view state will not be modified
    by javascript.

    And can someone point out a link list the properties been preserved in
    viewstate. Seems Button.Text is not.

    And viewstate will be always build and modified on server side, right? It
    never happens on client side (except hacker).

    ===============
    Another issue is ASP.NET render <asp:RadioButton> in a <span
    disabled="disabled"> <input type=radio disabled="disabled"> </span>, this
    is problematic in IE for javascript. First disabled is not a vlid property
    for span, second, when I write javascript to enable radio button, I have to
    remvoe "disable" attr of <span> as well. -- Why Microsoft does that?



    Thanks a lot!
    Ryan
     
    Ryan Liu, Mar 27, 2009
    #1
    1. Advertising

  2. Ryan Liu

    bruce barker Guest

    Re: 3+ basic questions for asp:RadioButton, related to ViewState,life cycle, javascript

    the browser does not postback disabled fields. also it only posts back
    the name and value of <input>, <select> and <textarea> elements inside
    of the posting form. in the case of input type checkbox and radio, only
    the value of a selected one is posted back.

    you can use hidden fields to post back addition info via client script.

    -- bruce (sqlwork.com)

    Ryan Liu wrote:
    > Just curious, why, for instance
    >
    > <asp:RadioButton runat="server"> or <intput type="radio" runat="server"
    > disabled="disabled"> will not post "Checked" state back if initially
    > they are disabled, either disabled in code behind or mark up.
    >
    > I mointor http post string, actually the information is available.
    >
    > Also <asp:Button> 's Text property is also not post back if I changed it
    > on client side using javascript.
    >
    > ================
    > This leads me think about a more general question, for a user input
    > control, in asp.net life cycle,
    > when does it assign the server control's property with (old) value found
    > in view state, and
    > when does the same property be assigned with new value in Request.Params
    > (user type in input), and overwrite property value got from view state,
    > and I assume then update viewstate with new values from user input?
    >
    > I read MSDN online, it only mention load viewstate and control state,
    > does not mention when to load user input.
    >
    > And on server side, does it treat user type in input same as the value
    > modified by client javascript? But of couse, view state will not be
    > modified by javascript.
    >
    > And can someone point out a link list the properties been preserved in
    > viewstate. Seems Button.Text is not.
    >
    > And viewstate will be always build and modified on server side, right?
    > It never happens on client side (except hacker).
    >
    > ===============
    > Another issue is ASP.NET render <asp:RadioButton> in a <span
    > disabled="disabled"> <input type=radio disabled="disabled"> </span>,
    > this is problematic in IE for javascript. First disabled is not a vlid
    > property for span, second, when I write javascript to enable radio
    > button, I have to remvoe "disable" attr of <span> as well. -- Why
    > Microsoft does that?
    >
    >
    >
    > Thanks a lot!
    > Ryan
     
    bruce barker, Mar 27, 2009
    #2
    1. Advertising

  3. Ryan Liu

    bruce barker Guest

    Re: 3+ basic questions for asp:RadioButton, related to ViewState,life cycle, javascript

    addendum:

    most controls (if they follow the ms pattern), store all properties in
    viewstate (this is why its so big, and shoudl be disabled in most cases).

    a control has a life cycle, if your control accepts user input a
    loaddata event. loaddata happens between oninit and onload. load of
    viewstate happen between oninit and loaddata.

    -- bruce (sqlwork.com)

    bruce barker wrote:
    > the browser does not postback disabled fields. also it only posts back
    > the name and value of <input>, <select> and <textarea> elements inside
    > of the posting form. in the case of input type checkbox and radio, only
    > the value of a selected one is posted back.
    >
    > you can use hidden fields to post back addition info via client script.
    >
    > -- bruce (sqlwork.com)
    >
    > Ryan Liu wrote:
    >> Just curious, why, for instance
    >>
    >> <asp:RadioButton runat="server"> or <intput type="radio"
    >> runat="server" disabled="disabled"> will not post "Checked" state back
    >> if initially they are disabled, either disabled in code behind or mark
    >> up.
    >>
    >> I mointor http post string, actually the information is available.
    >>
    >> Also <asp:Button> 's Text property is also not post back if I changed
    >> it on client side using javascript.
    >>
    >> ================
    >> This leads me think about a more general question, for a user input
    >> control, in asp.net life cycle,
    >> when does it assign the server control's property with (old) value
    >> found in view state, and
    >> when does the same property be assigned with new value in
    >> Request.Params (user type in input), and overwrite property value got
    >> from view state,
    >> and I assume then update viewstate with new values from user input?
    >>
    >> I read MSDN online, it only mention load viewstate and control state,
    >> does not mention when to load user input.
    >>
    >> And on server side, does it treat user type in input same as the value
    >> modified by client javascript? But of couse, view state will not be
    >> modified by javascript.
    >>
    >> And can someone point out a link list the properties been preserved in
    >> viewstate. Seems Button.Text is not.
    >>
    >> And viewstate will be always build and modified on server side, right?
    >> It never happens on client side (except hacker).
    >>
    >> ===============
    >> Another issue is ASP.NET render <asp:RadioButton> in a <span
    >> disabled="disabled"> <input type=radio disabled="disabled"> </span>,
    >> this is problematic in IE for javascript. First disabled is not a
    >> vlid property for span, second, when I write javascript to enable
    >> radio button, I have to remvoe "disable" attr of <span> as well. --
    >> Why Microsoft does that?
    >>
    >>
    >>
    >> Thanks a lot!
    >> Ryan
     
    bruce barker, Mar 27, 2009
    #3
  4. Ryan Liu

    Ryan Liu Guest

    Thanks! Initilally I disalbed the control, but I alreay enabled them in
    browser by javascript and I see data in http post stream.



    "bruce barker" <> wrote in message
    news:%...
    > the browser does not postback disabled fields. also it only posts back the
    > name and value of <input>, <select> and <textarea> elements inside of the
    > posting form. in the case of input type checkbox and radio, only the value
    > of a selected one is posted back.
    >
    > you can use hidden fields to post back addition info via client script.
    >
    > -- bruce (sqlwork.com)
    >
    > Ryan Liu wrote:
    >> Just curious, why, for instance
    >>
    >> <asp:RadioButton runat="server"> or <intput type="radio" runat="server"
    >> disabled="disabled"> will not post "Checked" state back if initially they
    >> are disabled, either disabled in code behind or mark up.
    >>
    >> I mointor http post string, actually the information is available.
    >>
    >> Also <asp:Button> 's Text property is also not post back if I changed it
    >> on client side using javascript.
    >>
    >> ================
    >> This leads me think about a more general question, for a user input
    >> control, in asp.net life cycle,
    >> when does it assign the server control's property with (old) value found
    >> in view state, and
    >> when does the same property be assigned with new value in Request.Params
    >> (user type in input), and overwrite property value got from view state,
    >> and I assume then update viewstate with new values from user input?
    >>
    >> I read MSDN online, it only mention load viewstate and control state,
    >> does not mention when to load user input.
    >>
    >> And on server side, does it treat user type in input same as the value
    >> modified by client javascript? But of couse, view state will not be
    >> modified by javascript.
    >>
    >> And can someone point out a link list the properties been preserved in
    >> viewstate. Seems Button.Text is not.
    >>
    >> And viewstate will be always build and modified on server side, right? It
    >> never happens on client side (except hacker).
    >>
    >> ===============
    >> Another issue is ASP.NET render <asp:RadioButton> in a <span
    >> disabled="disabled"> <input type=radio disabled="disabled"> </span>,
    >> this is problematic in IE for javascript. First disabled is not a vlid
    >> property for span, second, when I write javascript to enable radio
    >> button, I have to remvoe "disable" attr of <span> as well. -- Why
    >> Microsoft does that?
    >>
    >>
    >>
    >> Thanks a lot!
    >> Ryan
     
    Ryan Liu, Mar 27, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john doe Jr

    ASP Life Cycle Problem

    john doe Jr, Dec 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    834
    Teemu Keiski
    Dec 5, 2003
  2. S. Justin Gengo

    Re: ASP Life Cycle Problem

    S. Justin Gengo, Dec 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    475
    S. Justin Gengo
    Dec 8, 2003
  3. TB
    Replies:
    12
    Views:
    849
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Oct 27, 2005
  4. HP
    Replies:
    3
    Views:
    611
  5. Replies:
    3
    Views:
    216
    Lasse Reichstein Nielsen
    Sep 22, 2009
Loading...

Share This Page