Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > 3+ basic questions for asp:RadioButton, related to ViewState, life cycle, javascript

Reply
Thread Tools

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

 
 
Ryan Liu
Guest
Posts: n/a
 
      03-27-2009
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

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-27-2009
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

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-27-2009
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

 
Reply With Quote
 
Ryan Liu
Guest
Posts: n/a
 
      03-27-2009
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rechargeable batter life related question skarkada@gmail.com Digital Photography 7 12-17-2006 06:57 PM
Rechargeable battery life related question skarkada@gmail.com Digital Photography 7 12-17-2006 03:40 PM
How should multiple (related) projects be arranged (structured) and configured so that they can share code, have a related package structure and enable proper unittesting, and ensuring no namespace collisions ToddLMorgan@gmail.com Python 14 04-21-2006 04:03 PM
How should threads be terminated? (related to 'Help with thread related tracebacks') Maxwell Hammer Python 7 06-18-2005 04:20 PM



Advertisments