I have a slider whose minimum and maximum value has to be taken from a label
我有一个滑块,其最小值和最大值必须从标签中获取
Following is the code
以下是代码
<asp:SliderExtender ID="TextBox3_SliderExtender" runat="server" BehaviorID="TextBox3"
BoundControlID="TextBox4" TargetControlID="TextBox3" EnableHandleAnimation="true"
Maximum='<%# Math.Round(((double)lblMax.Text),0) %>' Minimum='<%# Math.Round((double)lblMin.Text,0) %>' Orientation="Horizontal" Steps="100" />
the error in above code is cannot convert type 'string to 'double'
上面代码中的错误是无法将'string'类型转换为'double'
how can i set maximum value from label named lblMax as Maximum for slider extender (Note : - lblMax contain integer value)
如何将名为lblMax的标签的最大值设置为最大滑块扩展器(注意: - lblMax包含整数值)
Maximum='<%# Math.Round(((double)lblMax.Text),0) %>'
2 个解决方案
#1
0
You can't directly cast a string to a double. You're looking for double.Parse()
.
您不能直接将字符串转换为double。你正在寻找double.Parse()。
#2
0
The minimum and maximum value can be set throught code as
最小值和最大值可以通过代码设置为
TextBox3_SliderExtender.Minimum = int.Parse(lblMin.Text.ToString()); TextBox3_SliderExtender.Maximum = int.Parse(lblMax.Text.ToString());
TextBox3_SliderExtender.Minimum = int.Parse(lblMin.Text.ToString()); TextBox3_SliderExtender.Maximum = int.Parse(lblMax.Text.ToString());
that will pick the value from the label and we can assign dynamically the value to tha label
这将从标签中选择值,我们可以动态地将值分配给tha标签
thax 4 the help
thax 4的帮助
#1
0
You can't directly cast a string to a double. You're looking for double.Parse()
.
您不能直接将字符串转换为double。你正在寻找double.Parse()。
#2
0
The minimum and maximum value can be set throught code as
最小值和最大值可以通过代码设置为
TextBox3_SliderExtender.Minimum = int.Parse(lblMin.Text.ToString()); TextBox3_SliderExtender.Maximum = int.Parse(lblMax.Text.ToString());
TextBox3_SliderExtender.Minimum = int.Parse(lblMin.Text.ToString()); TextBox3_SliderExtender.Maximum = int.Parse(lblMax.Text.ToString());
that will pick the value from the label and we can assign dynamically the value to tha label
这将从标签中选择值,我们可以动态地将值分配给tha标签
thax 4 the help
thax 4的帮助