How to use Slider with MVC textbox where data parallels

hi
I have added the slider Myslider1 to an MVC .cshtml page, but the goal is to “connect” the value with a textbox that represents a model value. So if the cshtml is

  @Html.EditorFor(model => model.CyclePercentComplete)

then add:
$(“#Myslider”).OnChange ( function() {
$(“@Model.CyclePercentComplete”).val(Myslider1);
}

?

when doing this, it has an infinite alert, hard to clear the browser even:

[code]
var mySlider, mySlider2;

	function doOnLoad() {
		mySlider = new dhtmlXSlider({
			parent: "sliderObj",
			size: 350,
			value: 50,
			step: 1,
			min:  0,
			max: 100
		});

		mySlider.attachEvent("onChange", function (value) {
		    alert("val");
		});
	};

[/code]

Linking Slider to Object
The slider can be linked to some objects on page. In this case, the linkTo() method is used. The slider can be linked to:
An HTML input;
An HTML textarea;
An HTML select;
Any HTML container tag.
mySlider.linkTo(objectId);
The example provided below shows the way how the slider can be linked to an HTML input:

But I am not able to link the mvc EditorFor() variable.

  @Html.EditorFor(model => model.PercentCycleComplete, new { @id = "PCC" })

and then

[code] function doOnLoad() {

    var mySlider = new dhtmlXSlider({
        parent: "sliderObj",
        size: 350,
        value: 50,
        step: 1,
        min: 0,
        max: 100



    });
    mySlider.linkTo("PCC");


};[/code]

Now when i mistakenly used the MVC’s labelFor variable? it linked up, but took the label away, it will not link with the editorfor

then i think ok, lets change it to textboxFor() ? and now its linked up, sort of.

they link but then it always defaults to the sliders default and ignores the value of the mvc from the database. so no matter what it is, its showing 50 (my default value)

Hi

Could you please provide us complete demo including all correspondnig js/css files?
Please also add information regarding current and expected behaviour.

Here is a small guide how to make a complete demo:
docs.dhtmlx.com/tutorials__auxil … pport.html

If you don’t want to share your demo here for any reasons - you can send it to support@dhtmlx.com, if so - please include link to this forum topic.

If you’re using PRO Edition please send your demo to support@dhtmlx.com