Cant Append options to a select dropdown dynamically

i am creating a javascript function which when clicked will create two drop downs and one text box and will append the html to the container div

but the problem is that, somehow it can’t append the oprions to the two drop downs.

Here’s my script

var i = 0; function add_relation() { i = i + 1; var condition = $('<select />', { 'class' : 'relation-select', 'id' : 'condition_' + i, 'name' : 'condition[]' }); var key = $('<select />', { 'class' : 'relation-select', 'id' : 'key_' + i, 'name' : 'key[]' }); $("#key_"+i).append('<option value="">Select Key</option><option value="product_title">Title</option><option value="type">Type</option><option value="product_price">Price</option><option value="product_weight">Weight</option>'); $("#condition_"+i).append('<option value="">Select Condition</option>'+ '<option value="is_equal_to">Is Equal To</option>'+ '<option value="is_greater_than">Is Greater Than</option>'+ '<option value="is_less_than">Is Less Than</option>'+ '<option value="starts_with">Starts With</option>'+ '<option value="ends_with">Ends With</option>'+ '<option value="contains">Contains</option>'); var left = $('<div />', {'class' : 'relation-left','id' : 'relation_' + i}).append(condition).append(key).append($('<input />', { 'class' : 'relation-input', 'id' : 'constraint_' + i, 'type' : 'text', 'name' : 'constraint[]', 'data-provide' : 'typeahead', 'data-items' : '2' })); var right = $('<div />', {'class' : 'relation-right',html : $('<buton />', { 'class' : 'btn', 'name' : 'btn[]', 'value': 'X'}) }); var parent = $('<div />', {'class' : 'relation-parent_' + i}).append(left).append(right); $("#relation_container").append(parent); }

Linq Update Query error in WP8

I have a table in local storage for maintaining Shopping CART Items. It includes below mentioned rows and the DataContext is also here:

 [Table]
public class Database
{ [Column(CanBeNull = false, IsPrimaryKey=true,IsDbGenerated=true)] public int ProductUniqueID { get; set; } [Column(CanBeNull = false)] public int ProductID { get; set; } [Column(CanBeNull = false)] public string ProductName { get; set; } [Column(CanBeNull = false)] public int ProductPrice { get; set; } [Column(CanBeNull = false)] public int ProductQuantity { get; set; } [Column(CanBeNull = false)] public int ProductTotalPrice { get; set; } [Column(CanBeNull = true)] public string ProductImageURL { get; set; } [Column(CanBeNull = true)] public string ProductCatID { get; set; }
}

public class MFTDataContext : System.Data.Linq.DataContext
{ public MFTDataContext(string connectionString) : base(connectionString) { } public System.Data.Linq.Table<Database> MFTCart { get { return this.GetTable<Database>(); } }

}


Now I am running ITEM QUANTITY Update in query to update Item Quantity. But It shows error.

 private const string strConnectionString = @"isostore:/MFTDB9.sdf"; using (MFTDataContext MFTdb = new MFTDataContext(strConnectionString)) { var itemToChange = (from item in MFTdb.MFTCart where item.ProductID == singletonInstance.CartItemIDs[singletonInstance.ItemToChange] select item).Single(); itemToChange.ProductQuantity = singletonInstance.QuantityChanged; itemToChange.ProductTotalPrice = singletonInstance.QuantityChanged * itemToChange.ProductPrice; MFTdb.SubmitChanges(); }

But it is giving me error:
An exception of type ‘System.InvalidOperationException’ occurred in System.Data.Linq.ni.dll but was not handled in user code