javascript and label

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bob d

    javascript and label

    I have a form in which i am resetting the value of a label using javascript. I have another button on the form to save the record. However, when the record is saved, it is still taking the "old" value that was formerly on the form instead of the updated value that was provided using the javascript button. How do I get .net to read the lastest value on the form that is showing?
  • CMA

    #2
    Re: javascript and label

    i can see two reasons to happen this.
    first, if u r creating the server control in the page load or atleast u r
    setting the value of that, u have a trouble. bcos when postback with the
    button click, it will set the default value. to solve that, u have to use
    "IsPostBack " in the page load event.

    second, with the ViewState of the page. with the view state, it is holding
    the values of the page. so it may be resetting the value again when refresh.
    u can use a hidden server control and set the value there also when change
    the lable. so u can access that value in the button click ivent u need.

    hope this helps,
    CMA


    "bob d" <anonymous@disc ussions.microso ft.com> wrote in message
    news:171EB08D-45EE-4D1F-9B3B-DF20A289045C@mi crosoft.com...[color=blue]
    > I have a form in which i am resetting the value of a label using[/color]
    javascript. I have another button on the form to save the record. However,
    when the record is saved, it is still taking the "old" value that was
    formerly on the form instead of the updated value that was provided using
    the javascript button. How do I get .net to read the lastest value on the
    form that is showing?


    Comment

    • bruce barker

      #3
      Re: javascript and label

      only form fields are posted back, labels are not, so the server can no
      changes done to the label. use a hidden field to pass the data.

      -- bruce (sqlqwork.com)


      "bob d" <anonymous@disc ussions.microso ft.com> wrote in message
      news:171EB08D-45EE-4D1F-9B3B-DF20A289045C@mi crosoft.com...[color=blue]
      > I have a form in which i am resetting the value of a label using[/color]
      javascript. I have another button on the form to save the record. However,
      when the record is saved, it is still taking the "old" value that was
      formerly on the form instead of the updated value that was provided using
      the javascript button. How do I get .net to read the lastest value on the
      form that is showing?


      Comment

      Working...