I am loading a slider from values in a database:
private void LoadStageSlider(int StageID) |
{ |
bool Found = false; |
int Min = -1; |
int Max = -1; |
slideStage.Items.Clear(); |
Stage s = new Stage(); |
DataView DV = s.List(Master.SiteID, true); |
foreach (DataRow DR in DV.Table.Rows) |
{ |
int Value = int.Parse(DR["StageID"].ToString()); |
RadSliderItem item = new RadSliderItem(DR["StageName"].ToString(), DR["StageID"].ToString()); |
slideStage.Items.Add(item); |
if (Value == StageID) Found = true; |
if (Value > Max) Max = Value; |
if (Min == -1) Min = Value; |
else if (Value < Min) Min = Value; |
} |
if (Found) |
{ |
slideStage.Value = StageID; |
} |
} |
Here is the slider declaration:
<telerik:RadSlider runat="server" ID="slideStage" IsSelectionRangeEnabled="false" |
Width="450px" Height="40px" Enabled="true" ItemType="Item" TrackPosition="TopLeft" |
ToolTip="Move the slider to indicate the pipeline stage of this opportunity" |
Skin="Vista" ShowDecreaseHandle="true" ShowIncreaseHandle="true" /> |
The StageID values are database Identity values, so they can be just about any number.
When I load the slider, the slideStage.Value is correct; however when the page displays, the slider is not set to the correct value.
When I examine slideStage.Value on PostBack, the Value property appears to reflect the Item index, but the SelectedValue property is correct. I saw a reference that said Value on read will contain the Item index, and now I am thoroughly confused.
Please clarify for me how the Value/SelectedValue properties work and how I can set the slider properties so that it displays the correct value.
Thanks for any clarity you can shed on this puzzle.