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!
Hello Viktor,
thank you for your suggestions, to solve the problem.
In the meantime we have found the solution for our problem. As I tryed to explain we need to get the actual value after Page_Load is already completed in an eventhandler for a button-click-event.
In our original source we created a TableRow and added it to a Table. Then we created a TableCell and added it to the previously created TableRow. Finally we created and inititialized the WebSlider control and added it to the Controls-Collection of the previously created TableCell. This led to the problem, that we couldn't receive the actual value.
So I modified the source. Now I create the TableCell, then create and initialize the WebSlider and add it to the TableCell and finally I add the TableCell to the previously created TableRow. Now we get the actual value of the WebSlider controls.
As a result of the support request I also created, Alan, a colleague of you, suggested to add the TableRow to the Table after creating the TableCell with the WebSlider and adding it to the TableRow. This would also solve our problem.
So now we have two possibilities to solve our problem.
Regards,
Christian
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; }