Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Mobile > Mobile Forum > WP - pass the id from one page to next page depends upon selecteditem in windows phone



 

WP - pass the id from one page to next page depends upon selecteditem in windows phone

 



Topic : 099233

Guest




Hi.,

I am developing an one windows phone application.i have facing following issues.

I need to delete the selected item from the list.but unable to delete the selected item.

The last item only deleted when am selecting any item from that list.What's wrong in my code and concepts ???

please give me any suggestions ...


I have using following code on my app:


I have using below query for delete the selected item.

Code (PHP)
if (isset($_POST['product_id']) && isset($_POST['customer_id'])) {
    $product_id = $_POST['product_id'];
    $customer_id = $_POST['customer_id'];
   

    // mysql update row with matched pid
    $result = mysql_query("DELETE FROM pim_productdeal WHERE product_id = $product_id AND customer_id = $customer_id");



The below code for getting the list :

Code (C#)
private void client_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            if (e.Cancelled == false && e.Error == null)
            {
                MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
                ObservableCollection<Member> list = new ObservableCollection<Member>();
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ObservableCollection<Member>));
                list = (ObservableCollection<Member>)serializer.ReadObject(ms);

                List<Member> myCustomer = new List<Member>();
                foreach (var cm in list)
                {
                    string scustomerID = cm.customer_id;
                    sproductID = cm.product_id;
                    sproduct_name = cm.product_name.ToString();
                   

                    myCustomer.Add(new Member(scustomerID, sproductID, sproduct_name));
                }


i have to delete the product depends upon selecteditem:

Code (C#)
 private void Remove(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/DeletewatchList.xaml?sproductid=" + sproductID, UriKind.Relative));
        }


The following code for delete functionality:

Code (C#)
  private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
         {
             MessageBoxResult result = MessageBox.Show("Are you sure want to delete?", "Delete Message", MessageBoxButton.OKCancel);
             if (result == MessageBoxResult.OK)
             {
               
                 string url = "http://www.bestinuk.com/BestinUk_Windows/deleteproduct.php";
                 Uri uri = new Uri(url, UriKind.Absolute);
                 NavigationContext.QueryString.TryGetValue("sproductid", out sproductID);
                 StringBuilder postData = new StringBuilder();
                 postData.AppendFormat("{0}={1}", "product_id", HttpUtility.UrlEncode(InputList.sproductID));
                 postData.AppendFormat("&{0}={1}", "customer_id", HttpUtility.UrlEncode(LoginPage.strcustomer_id_k));
                
                 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_UploadStringComplete;
                 client.UploadProgressChanged += client_UploadProgressChangedes;

                 client.UploadStringAsync(uri, "POST", postData.ToString());

                 prog = new ProgressIndicator();
                 prog.IsIndeterminate = true;
                 prog.IsVisible = true;
                 prog.Text = "Loading....";
                 SystemTray.SetProgressIndicator(this, prog);
             }
             else
             {
                 NavigationService.Navigate(new Uri("/InputList.xaml?selectedItem=", UriKind.Relative));
             }



please read my question and give me solution.

The list of product is displaying well.
if i have to delete the any product from these list means the last product only deleted from that list.

For EG:

The list having 3 products.now i have to delete the second product means the 3rd product only deleted from these list.

please check my code.why am facing these problem .

What's wrong in my code ??? please give me any suggestions ....



Tag : Mobile, MySQL, Device (Mobile), C#, Windows Phone, Windows







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-08-17 20:58:43 By : li View : 1085 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Sample



Windows Phone Edit Update data to Web Server







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-21 06:36:59 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : WP - pass the id from one page to next page depends upon selecteditem in windows phone
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่