Checkmark not saving state on round trip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark B

    Checkmark not saving state on round trip

    Even though I have EnableViewState set to true, CheckBox1 is not retaining
    its value (false) on page reload.

    I have an OnLoad page sub that queries a SQL table for the member's record.

    I use Dim bolLoadedOnce As Boolean in the codebehind class for the page.

    Then I use:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
    Handles Me.Load

    If bolLoadedOnce = True Then

    Else
    fLoadMemberSett ings()
    bolLoadedOnce = True
    End If

    End Sub

    When I un-tick CheckBox1 it automatically fires a page reload which loads up
    CheckBox1 as True again. I want it to remember that I un-ticked it.

  • Eliyahu Goldin

    #2
    Re: Checkmark not saving state on round trip

    Get rid of bolLoadedOnce. It 1) doesn't survive postbacks and 2) already
    provided by ASP.NET as IsPostBack property.

    Use IsPostBack.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]




    "Mark B" <none@none.comw rote in message
    news:uln%23dqc1 IHA.2208@TK2MSF TNGP04.phx.gbl. ..
    Even though I have EnableViewState set to true, CheckBox1 is not retaining
    its value (false) on page reload.
    >
    I have an OnLoad page sub that queries a SQL table for the member's
    record.
    >
    I use Dim bolLoadedOnce As Boolean in the codebehind class for the page.
    >
    Then I use:
    >
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArg s) Handles Me.Load
    >
    If bolLoadedOnce = True Then
    >
    Else
    fLoadMemberSett ings()
    bolLoadedOnce = True
    End If
    >
    End Sub
    >
    When I un-tick CheckBox1 it automatically fires a page reload which loads
    up CheckBox1 as True again. I want it to remember that I un-ticked it.

    Comment

    • Mark B

      #3
      Re: Checkmark not saving state on round trip

      Thanks.

      That did it.

      "Eliyahu Goldin" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
      message news:OnPRfWd1IH A.4492@TK2MSFTN GP02.phx.gbl...
      Get rid of bolLoadedOnce. It 1) doesn't survive postbacks and 2) already
      provided by ASP.NET as IsPostBack property.
      >
      Use IsPostBack.
      >
      --
      Eliyahu Goldin,
      Software Developer
      Microsoft MVP [ASP.NET]


      >
      >
      "Mark B" <none@none.comw rote in message
      news:uln%23dqc1 IHA.2208@TK2MSF TNGP04.phx.gbl. ..
      >Even though I have EnableViewState set to true, CheckBox1 is not
      >retaining its value (false) on page reload.
      >>
      >I have an OnLoad page sub that queries a SQL table for the member's
      >record.
      >>
      >I use Dim bolLoadedOnce As Boolean in the codebehind class for the page.
      >>
      >Then I use:
      >>
      >Protected Sub Page_Load(ByVal sender As Object, ByVal e As
      >System.EventAr gs) Handles Me.Load
      >>
      > If bolLoadedOnce = True Then
      >>
      > Else
      > fLoadMemberSett ings()
      > bolLoadedOnce = True
      > End If
      >>
      >End Sub
      >>
      >When I un-tick CheckBox1 it automatically fires a page reload which loads
      >up CheckBox1 as True again. I want it to remember that I un-ticked it.
      >
      >

      Comment

      Working...