Hello,
I am new at programming. I want to email the value of the item selected in RadSlider.
The RadSlider looks like this:
I read this forum and followed teh instrcutions in another post about how to get teh value, but it didn't work.
This is what I wrote:
The error is saying that
Please help me make this work. It is probably something simple, but as I said, I am a beginner at this.
Best,
Brent.
I am new at programming. I want to email the value of the item selected in RadSlider.
The RadSlider looks like this:
| <telerik:RadSlider ID="RadSlider1" runat="server" ItemType="Item" Skin="WebBlue" |
| Width="717px" Height="66px" |
| OnClientValueChange="UpdateVisibleSlide" OnClientLoaded="UpdateVisibleSlide" |
| TrackPosition="TopLeft" AppendDataBoundItems="True" Length="720" > |
| <Items> |
| <telerik:RadSliderItem Text="Water" Height="100" Value="1"/> |
| <telerik:RadSliderItem Text="Fire" Value="2" /> |
| <telerik:RadSliderItem Text="Rock" Value="3"/> |
| <telerik:RadSliderItem Text="Sun" Value="4"/> |
| <telerik:RadSliderItem Text="Earth" Value="5"/> |
| </Items> |
| </telerik:RadSlider> |
I read this forum and followed teh instrcutions in another post about how to get teh value, but it didn't work.
This is what I wrote:
| Dim mm As New MailMessage() |
| Dim slider As RadSlider = TryCast(RadSlider1.FindControl("rslider"), Telerik.Web.UI.RadSlider) |
| Dim value As Integer = slider.Value |
| Dim routsegid As String = slider.Items(value).Value.ToString() |
| 'Assign the MailMessage's properties |
| mm.Subject = "Contact Form" |
| mm.IsBodyHtml = False |
| mm.Body = "The following enquiry has been received from the web on " & DateTime.Now.ToString("D") & ":" & vbCrLf & vbCrLf & _ |
| "Product: " & (slider.Items(value).Value.ToString()) & vbCrLf & vbCrLf & |
| Dim smtp As New SmtpClient |
The error is saying that
Line 31: Dim value As Integer = slider.Value
System.NullReferenceException: Object reference not set to an instance of an object.Please help me make this work. It is probably something simple, but as I said, I am a beginner at this.
Best,
Brent.