( [{"value":"","caption":"choose color"},
{"value":"bk","caption":"Black"}] ) but the drop downs are still not
populating. Here's the <select> after call returns:
<select id="colorDropdown" jQuery1243564736149="3"/>
It appears that jQuery has touch the element but there are no options.
On May 28, 5:14 pm, MorningZ <morni...@gmail.com> wrote:
> yuuuuuuuuccccckkkkk.... handcrafting JSON is a pain, thankfully
> there's great stuff out there by people who have thought of how to
> help, so some advice:
>
> grab this .NET component and drop it in your BIN directory:
>
> http://www.codeplex.com/json(note the new version only works
> with .NET 3.5, grab the older one if you're in 2.0)
>
> then you can stay thinking like .NET and objects
>
> Class for each item
>
> Private Class Item
>
> Private _value As String
> Public Property value() As String
> Get
> Return _value
> End Get
> Set(ByVal value As String)
> _value = value
> End Set
> End Property
>
> Private _caption As String
> Public Property caption() As String
> Get
> Return _caption
> End Get
> Set(ByVal value As String)
> _caption = value
> End Set
> End Property
>
> Public Sub New(ByVal i_value As String, ByVal i_caption As
> String)
> Me.value = i_value
> Me.caption = i_caption
> End Sub
>
> End Class
>
> Then to generate (and at the end the NewtonSoft object will take care
> of all JSON converstion that $.getJSON reads with no issues)
>
> Dim Options As List(Of Item) = New List(Of Item)
> If Not IsNothing(qs) Then
> Options.Add(New Item("", "choose color"))
> Select Case qs
> Case "7141832"
> sku = "7141832"
> Options.Add(New Item("bk", "Black Oil-tanned"))
> Options.Add(New Item("br", "Black Polishable"))
> Case "7173656"
> sku = "7173656"
> Options.Add(New Item("bk", "Black"))
> Options.Add(New Item("br", "Crazy Horse"))
> Case "7269643"
> sku = "7269643"
> Options.Add(New Item("bk", "Black"))
> Case Else
> Options.Add(New Item("bk", "Black"))
> End Select
>
> Response.Write
> (Newtonsoft.Json.JavaScriptConvert.SerializeObject(Options))
>
> End If
No comments:
Post a Comment