locked
How to SaveState of 3 TextBlock? RRS feed

  • Question

  • Hi,

    I have 3 TextBox (txtHour, txtMin, txtSec)

     

    protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)

            {

                // Restore values stored in session state.

                if (pageState != null && pageState.ContainsKey("MyValueHour"))

                {

                    txtHour.Text = pageState["MyValueHour"].ToString();

                }

                if (pageState != null && pageState.ContainsKey("MyValueMin"))

                {

                    txtHour.Text = pageState["MyValueMin"].ToString();

                }

                if (pageState != null && pageState.ContainsKey("MyValueSec"))

                {

                    txtHour.Text = pageState["MyValueSec"].ToString();

                }

            }

     

      protected override void SaveState(Dictionary<String, Object> pageState)

            {

                pageState["MyValueHour"] = txtHour.Text;

                pageState["MyValueMin"] = txtMin.Text;

                pageState["MyValueSec"] = txtSec.Text;

            }

     

    If I Suspend and Resume I have only first Hour.


    ADRIAN DIBU

    Thursday, January 10, 2013 3:24 PM

Answers

  • Hi,

    I have 3 TextBox (txtHour, txtMin, txtSec)

     

    protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)

            {

                // Restore values stored in session state.

                if (pageState != null && pageState.ContainsKey("MyValueHour"))

                {

                    txtHour.Text = pageState["MyValueHour"].ToString();

                }

                if (pageState != null && pageState.ContainsKey("MyValueMin"))

                {

                    txtHour.Text = pageState["MyValueMin"].ToString();

                }

                if (pageState != null && pageState.ContainsKey("MyValueSec"))

                {

                    txtHour.Text = pageState["MyValueSec"].ToString();

                }

            }

     

      protected override void SaveState(Dictionary<String, Object> pageState)

            {

                pageState["MyValueHour"] = txtHour.Text;

                pageState["MyValueMin"] = txtMin.Text;

                pageState["MyValueSec"] = txtSec.Text;

            }

     

    If I Suspend and Resume I have only first Hour.


    ADRIAN DIBU

    You are setting txtHour.Text 3 times in LoadState, you need to also set txtMin.Text & txtSec.Text.


    British Airways Inspiration App & rara music

    • Marked as answer by adibu Thursday, January 10, 2013 4:36 PM
    Thursday, January 10, 2013 3:57 PM

All replies

  • Hi,

    I have 3 TextBox (txtHour, txtMin, txtSec)

     

    protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)

            {

                // Restore values stored in session state.

                if (pageState != null && pageState.ContainsKey("MyValueHour"))

                {

                    txtHour.Text = pageState["MyValueHour"].ToString();

                }

                if (pageState != null && pageState.ContainsKey("MyValueMin"))

                {

                    txtHour.Text = pageState["MyValueMin"].ToString();

                }

                if (pageState != null && pageState.ContainsKey("MyValueSec"))

                {

                    txtHour.Text = pageState["MyValueSec"].ToString();

                }

            }

     

      protected override void SaveState(Dictionary<String, Object> pageState)

            {

                pageState["MyValueHour"] = txtHour.Text;

                pageState["MyValueMin"] = txtMin.Text;

                pageState["MyValueSec"] = txtSec.Text;

            }

     

    If I Suspend and Resume I have only first Hour.


    ADRIAN DIBU

    You are setting txtHour.Text 3 times in LoadState, you need to also set txtMin.Text & txtSec.Text.


    British Airways Inspiration App & rara music

    • Marked as answer by adibu Thursday, January 10, 2013 4:36 PM
    Thursday, January 10, 2013 3:57 PM
  • Hi,

    Thanks very much.


    ADRIAN DIBU

    Thursday, January 10, 2013 4:36 PM