在我的.aspx页中,我正在使用AJAX SliderExtender控件。它很好用,但看起来很基本,所以我想尝试自定义样式,但无法使其正常工作。这是我尝试的代码:
Dim slidext_sliderBox_SliderExtender As New SliderExtender
With slidext_sliderBox_SliderExtender
.ID = "slidext_sliderBox_SliderExtender_" & idx.ToString
.Maximum = 10
.Minimum = 0
.TargetControlID = "txtboxSliderBox_" & idx.ToString
.RaiseChangeOnlyOnMouseUp = False
.Length = 310
Dim NewStyle As New HtmlGenericControl
With NewStyle
.TagName = "style"
.Attributes.Add("type", "text/css")
.Attributes.Add("id", "ajax__slider_h_railNEW")
.Attributes.Add("runat", "server")
.InnerText = "ajax__slider_h_railNEW {position: absolute; background: url('Images/dot.gif') repeat; height: 18px; width: 50px;}"
.InnerHtml = "ajax__slider_h_railNEW {position: absolute; background: url('Images/dot.gif') repeat; height: 18px; width: 50px;}"
End With
Page.Header.Controls.Add(NewStyle)
.RailCssClass = "ajax__slider_h_railNEW"
结果是导轨消失了,只有手柄出现在控件所在的左下角。