Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
Actual WebSlider value not available server-side, after assigning a specific ID
posted

Hello,

I have some problems with WebSlider-Controls.

In our Web-Application we create all dialogues and the containing controls dynamically. For client-side handling, our controls get specific IDs. So we can easily itdentify them for example in JavaScript-functions.

With WebSlider I now have the problem, that I don't get the actual Value as soon as I have set an ID by my own. After returning to the server and rebuilding the dialogue within Page_Load I only get the initial value and not the value which was selected client-side.

For testing this behavior I also created a small Web-Application with a "static" WebSlider-Control on the Default.aspx and a Button-Control for Starting PostBack. As long as I don't set an ID by my own, I always get the actual Value when returning to Page_Load at server. As soon as I set an specific ID I don't get the actual value anymore.

 We are using "assembly="Infragistics35.Web.v9.1, Version=9.1.20091.1015".

 Could anybody give me some advice, what I should do, to solve this problem?

Thank you very much!

 

Parents
  • 24497
    Verified Answer
    posted

    Hi Chris,

    Approach to get value of control straight after it was dynamically created (within same server event) looked unusual to me, so, I tested slider and standard textbox for that. None of them worked, and TextBox was not able to return value even from previous session (I guess because textbox does not use ViewState to store Text property).

    You should separate in time creation of dynamic control and getting its value from last session: use different threads/events/etc. I would suggest to move creation of sliders in Page.OnInit. However, if you for some reason can not use OnInit, then you may create sliders in Page.OnLoad, but get value from last session within Page.OnLoadComplete or later. Below example has submit button and 2 text boxes to show outputs of results.

     private TextBox _textbox;
     private WebSlider _slider;
     protected void Page_Load(object sender, EventArgs e)
     {
      this._textbox = new TextBox();
      this._textbox.ID = "TB1";
      this.Form.Controls.Add(this._textbox);
      this._slider = new WebSlider();
      this._slider.ID = "MySliderUniqueID";
      this.Form.Controls.Add(this._slider);
      this.TextBox1.Text = "Slider:" + this._slider.Value + " text=" + this._textbox.Text;
     }
     protected void Page_LoadComplete(object sender, EventArgs e)
     {
      this.TextBox2.Text = "Slider:" + this._slider.Value + " text=" + this._textbox.Text;
     }

Reply Children
No Data