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,038

HOME > .NET Framework > Forum > ส่งค่าจาก ListView ไปโชว์อีก From นึงโดยกดปุ๋ม LinkButton C# พอดีช่วยแนะนำหน่อยว่าต้องส่งยังไงหรอครับ


 

[.NET] ส่งค่าจาก ListView ไปโชว์อีก From นึงโดยกดปุ๋ม LinkButton C# พอดีช่วยแนะนำหน่อยว่าต้องส่งยังไงหรอครับ

 
Topic : 119191



โพสกระทู้ ( 9 )
บทความ ( 0 )



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



From1 หน้า SportsEquipment.aspx

a

From2 หน้า Detailproduct.aspx

a1

โค้ดหน้าListView หน้า SportsEquipment.aspx

Code (C#)
01.<asp:ListView ID="ListView1" runat="server" style="text-align: center; color: #CC3300;"  OnItemCommand="ListView1_ItemCommand">
02.                                
03.                               <ItemTemplate>
04.                                   <div class="list">
05.                                   <table style="border: 1px solid #A55129;
06.                                       background-color: #FFF7E7" align="center" >
07.                    <tr>
08.                   <td style="width: 100px" Height="200px">
09.                      
10.                       <asp:Image ID="image"
11.                       ImageUrl='<%# "data:Image/png;base64," + Convert.ToBase64String((byte[])Eval("Productpic")) %>' Height="150px" width="100px"
12.                       runat="server" />
13.                   </td>
14.                   <td style="width: 180px" Height="200px">
15.                       <table>
16.                          
17.                          
18.                            
19.                          <tr>
20.                               <td>
21.                                   <b>เลขบัตรประชาชน:</b>
22.                               </td>
23.                               <td>
24.                                   <asp:Label ID="lblidcard"
25.                                   runat="server"
26.                                   Text='<%#Eval("UserIdentification") %>'>
27.                                   </asp:Label>
28.                               </td>
29.                           </tr>
30. 
31.                           <tr>
32.                               <td>
33.                                   <b>ชื่อสินค้า:</b>
34.                               </td>
35.                               <td>
36.                                   <asp:Label ID="lblnameproduct"
37.                                   runat="server"
38.                                   Text='<%#Eval("Productname") %>'>
39.                                   </asp:Label>
40.                               </td>
41.                           </tr>
42.                           <tr>
43.                               <td>
44.                                   <b>ราคา:</b>
45.                               </td>
46.                               <td>
47.                                   <asp:Label ID="Label2"
48.                                   runat="server"
49.                                   Text='<%#Eval("Productprice") %>'>
50.                                   </asp:Label>
51.                               </td>
52.                           </tr>
53.                           <tr>
54.                               <td>
55.                                   <b>วันที่ประกาศ:</b>
56.                               </td>
57.                               <td>
58.                                   <asp:Label ID="Label3"
59.                                   runat="server"
60.                                   Text='<%#Eval("Producteditdate") %>'>
61.                                   </asp:Label>
62.                               </td>
63.                           </tr>
64.                           <tr>
65.                               <td>
66. 
67.                                    
68.                                   <asp:LinkButton ID="LinkButton1" runat="server">รายละเอียดสินค้า</asp:LinkButton>
69.                               </td>
70. 
71. 
72.                           </tr>
73.                       </table>
74.                       
75.                   </td>
76.               </tr>
77.           </table>
78.           </div>
79.           </ItemTemplate>
80. 
81.                    </asp:ListView>


ผมต้องการให้กดที่รายละเอียดแล้วส่งข้อมูลจากfromแรกไปแสดงตาม Label ที่ได้สร้างไว้ โดยเลขบัตรประชาชน
จะเป็น PK แต่ในFromแรกผมโชว์ข้อมูลแค่4อย่างแต่ตอนรับในอีก From จะรับมาโชว์ค่าทุกตัวตามตารางที่เก็บข้อมูล
ในฐานข้อมูล ผมควรทำอย่างไรบ้างศึกษาเรื่องอะไรบ้าง ใช้ even อะไรบ้าง หรือมีตัวอย่างคล้ายๆแบบนี้ ช่วยแนะนำหน่อยคับ
ขอบคุนล่วงหน้าครับ



Tag : .NET, Ms SQL Server 2012, Web (ASP.NET), C#



ประวัติการแก้ไข
2015-10-02 14:20:07
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-10-02 14:18:20 By : aswxsun View : 1034 Reply : 4
 

 

No. 1



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

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

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

ส่งผ่าน HyperLink ครับ จากนั้นใช้พวก QueryString รับค่าครับ



Code (C#)
01.void ViewData()
02.{
03.    //*** DataTable ***//
04.    SqlDataAdapter dtAdapter;
05.    DataTable dt = new DataTable();
06.    strSQL = "SELECT * FROM customer WHERE CustomerID = '"+ Request.QueryString["CustomerID"] +"' ";
07.    dtAdapter = new SqlDataAdapter(strSQL, objConn);
08.    dtAdapter.Fill(dt);
09. 
10.    if(dt.Rows.Count > 0)
11.    {
12.        this.txtCustomerID.Text = (string)dt.Rows[0]["CustomerID"];
13.        this.txtName.Text = (string)dt.Rows[0]["Name"];
14.        this.txtEmail.Text = (string)dt.Rows[0]["Email"];
15.        this.txtCountryCode.Text = (string)dt.Rows[0]["CountryCode"];
16.        this.txtBudget.Text = (string)dt.Rows[0]["Budget"].ToString();
17.        this.txtUsed.Text = (string)dt.Rows[0]["Used"].ToString();
18.    }
19.}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-02 21:32:04 By : mr.win
 

 

No. 2



โพสกระทู้ ( 9 )
บทความ ( 0 )



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


ขอบคุณมากๆครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-03 15:18:55 By : aswxsun
 

 

No. 3



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

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

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


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-03 19:37:42 By : mr.win
 

 

No. 4



โพสกระทู้ ( 9 )
บทความ ( 0 )



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


ขอโทษนะครับช่วยผมอีกนิดนะคับ พอดีผมเขียนโค้ดตามที่พี่บอกแล้ว แต่เหมือนว่า listview มันไม่อ่านคอนโทลของ label มันต้องแก้ยังไง
หรอครับ และอีกอย่างผมจะส่งรูปไปแสดงที่คอนโทล image ให้from ที่สร้างไว้ต้องส่งยังไงหรอคับ รบกวนด้วยนะคับ ขอบคุนล่วงหน้าครับ

นี้โค้ดตรงที่ไม่อ่านคอนโทลนะคับตรง this.lblidcard.Text,this.lblnameproduct.Text,this.lblprice.Text,this.lbldate.Text ควรแก้ยังไงหรอคับ
Code (C#)
01.void ViewData()
02.       {
03.           SqlDataAdapter da;
04.           DataTable dt = new DataTable();
05.           string cmd = "SELECT Username , Userphone ,CustomerUser.UserIdentification,Useremail,Productname,Productprice,Productdetail,Productpic,Productdate,Producteditdate FROM  CustomerUser  JOIN ProductSecondHand ON CustomerUser.UserIdentification = ProductSecondHand.UserIdentification WHERE ProductSecondHand.UserIdentification = '" + Request.QueryString["UserIdentification"] + "'";
06.           da = new SqlDataAdapter(cmd, con);
07.           da.Fill(dt);
08. 
09.           if (dt.Rows.Count > 0)
10.           {
11. 
12.               this.lblidcard.Text = (string)dt.Rows[0]["UserIdentification"];
13.               this.lblnameproduct.Text = (string)dt.Rows[0]["Productname"];
14.               this.lblprice.Text = (string)dt.Rows[0]["Productprice"];
15.               this.lbldate.Text = (string)dt.Rows[0]["Producteditdate"];
16.               
17. 
18.           }
19. 
20.         }

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-05 10:22:56 By : aswxsun
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ส่งค่าจาก ListView ไปโชว์อีก From นึงโดยกดปุ๋ม LinkButton C# พอดีช่วยแนะนำหน่อยว่าต้องส่งยังไงหรอครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





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