How to save selected data from listpicker using mysql /php?
Hi i am developing windows phone app. I need to save selected data to mysql table from list picker using mysql/ php. if i save any selected data it will store class name. so i am given below my code.please any one tell me how to solve in this issue.
This is my xaml code
Code (ASP)
<Border Background="White" CornerRadius="15" Margin="0,0,32,0" BorderThickness="1" BorderBrush="Gray">
<toolkit:ListPicker x:Name="RetailerList" ItemsSource="{Binding Retailerslist}" Foreground="Black" BorderThickness="0" Margin="30,-1,39,0" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding retailername}" FontSize="20" FontFamily="Arial" Foreground="Black" TextWrapping="Wrap" />
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
</toolkit:ListPicker>
</Border>
My C# Code it's retrieve from xml feed
Code (C#)
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
string selectedIndex = "";
if (NavigationContext.QueryString.TryGetValue("scustomerID", out selectedIndex))
{
RetailerList.ItemsSource = App.ProductList.Producttype;
}
}
save data to mysql table
Code (C#)
string url = "http://www.best.com/Best_Windows/insert.php";
Uri uri = new Uri(url, UriKind.Absolute);
StringBuilder postData = new StringBuilder();
postData.AppendFormat("{0}={1}", "product_id", HttpUtility.UrlEncode(ProductDetails.productId));
postData.AppendFormat("&{0}={1}", "customer_id", HttpUtility.UrlEncode(LoginPage.strcustomer_id_k));
postData.AppendFormat("&{0}={1}", "retailer",HttpUtility.UrlEncode(this.RetailerList.SelectedItem.ToString()));
WebClient client = default(WebClient);
client = new WebClient();
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
client.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString();
client.UploadStringCompleted += client_SaveUploadStringCompleted;
client.UploadProgressChanged += client_SaveUploadProgressChanged;
client.UploadStringAsync(uri, "POST", postData.ToString());
prog = new ProgressIndicator();
prog.IsVisible = true;
prog.Text = "Connecting update to server....";
SystemTray.SetProgressIndicator(this, prog);
Code (C#)
public class BestinukRetailers
{
public string retailername { get; set; }
}
This is when i am insert data to table i got result image
The given below image when i am retrieve saved data i got only class name, i can't able to get selected retailer
Tag : Mobile, MySQL, Device (Mobile), C#, Windows Phone, Windows
Date :
2013-08-26 20:54:40
By :
Dashi
View :
1227
Reply :
3
This article can help you ?
Windows Phone Add Insert Data into Web Server (PHP and MySQL)
Date :
2013-08-27 06:22:38
By :
mr.win
Hi Thank you for your reply. i need how to save data from list picker
Date :
2013-08-27 11:46:19
By :
Dashi
Code (C#)
RetailerList.SelectedItem
?
Date :
2013-08-27 12:58:07
By :
mr.win
Load balance : Server 04