|  | 
	                
  
    |  |  
    | 
        
        อยากทราบวิธี ดีบัค ตอนกดปุ่มที่ถูก add ใน table ครับแนะนำที table ที่ว่านี้ไม่ใช่ tr td นะครับ     |  
    |  |  
 
              
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลองใส่ภาพปลากรอบ ดูสิครับ เผื่อจะเข้าใจง่ายขึ้น 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-21 14:14:38 | By :
                            grart |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ปลากรอบไม่มีอ่ะครับ มีแต่ปลาเค็ม ^^ เด๋วผมเอารูปกับโค้ดมาลงละกันครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-21 16:31:54 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | จากตัวอย่างจะเรียก Sub ชื่อ ButtonClick 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-21 16:42:08 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ภาพตอนรันโปรแกรมนะครับ 
  
 จากภาพนั้นผมจะทำการ สร้างตารางตามจำนวนข้อมูลของผม ซึ่งในความเป็นจริงแล้วเราไม่รู้จำนวนตารางที่แน่นอนครับ
 
 หลังจากสร้างตารางแล้วผมจะ add Imagebutton เข้าไปในใส่ในแต่ละช่องของตาราง ตอน add Imagebutton  ผมก็ได้ใส่ id ให้แต่ละ ปุ่ม
 
 หลังจากนั้นผมก็รันโปรแกรม
 
 พอรันโปรแกรมแล้ว ผมคลิ้กที่ปุ่ม แล้วโปรแกรมจะรู้ได้ยังไงครับว่า ผมคลิกปุ่มไหน เราจะไปดัก ดีบัคได้ยังไงครับ แนะนำทีครับ เคยทำแต่
 
 checkbox ครับ
 
 
 นี้คือโค้ดสร้าง table ของผม
 
 Code (C#)
 
  public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           Show_Table(Table1);
        }
        public void Show_Table(Table Table)
        {
            int row = 0;
            int rows = 0;
            int count = 0;
            int column=0;
            if (15 >= 1)
            {
                rows = (15) / 1;
                while (row < rows)
                {
                    TableRow tr = new TableRow();
                    while (column < 5)
                    {
                        TableCell tcell = new TableCell();
                        Table dataTable = new Table();
                        ImageButton IB = new ImageButton();
                        TableRow datarow1 = new TableRow();
                        TableRow datarow2 = new TableRow();
                        TableRow datarow3 = new TableRow();
                        TableCell datacell1_1 = new TableCell();
                        TableCell datacell2_1 = new TableCell();
                        TableCell datacell3_1 = new TableCell();
                     
                            IB.ImageUrl = "image/aa.bmp";
                            IB.ID = "ID"+ count;
                            datacell1_1.Controls.Add(IB);
                            datarow1.Cells.Add(datacell1_1);
                            datarow1.BackColor = System.Drawing.Color.AliceBlue;
                            datarow2.Cells.Add(datacell2_1);
                            datarow2.BackColor = System.Drawing.Color.Aquamarine;
                            datarow3.Cells.Add(datacell3_1);
                            datarow3.BackColor = System.Drawing.Color.Brown;
                         //   dataTable.BorderStyle = WebControls.BorderStyle.Solid;
                            dataTable.BorderWidth = Unit.Pixel(2);
                            dataTable.Rows.Add(datarow1);
                            dataTable.Rows.Add(datarow2);
                            dataTable.Rows.Add(datarow3);
                         //   dataTable.BackColor = color_T;
                            dataTable.Width = Unit.Parse("100%");
                            dataTable.Height = Unit.Parse("250px");
                            dataTable.Attributes.Add("style", "table-layout:fixed");
                            dataTable.Font.Name = "verdana";
                            tcell.Controls.Add(dataTable);
                            tr.Cells.Add(tcell);
                        count = count + 1;
                        column = column + 1;
                    }
                    Table.Rows.Add(tr);
                    Table.Attributes.Add("style", "table-layout:fixed");
                    if (Table.Rows.Count > 0)
                    {
                        Table.Width = (250 * (Table.Rows[0].Cells.Count));
                        Table.Height = (250 * (Table.Rows.Count));
                    }
                    column = 0;
                    row=row+1;
                }
            }
        }
    }
 ทั้งโปรแกรมมีแค่นี้แหละครับ ทำมาทดสอบ ^^
 แนะนำทีครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-22 11:35:21 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | แนะนำทีคร้าบ ^^ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-22 17:24:50 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (VB.NET) 
 AddHandler IB.Click, AddressOf ButtonClick
 
 ใส่ก่อน LoadControl แค่นี้ก็น่าจะได้น่ะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-22 20:39:18 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับพี่วิน แต่ติดปัญหาอีกอันนึงครับ
 
 ตอนนี้ดีบัคได้แล้วครับ แต่ไม่สามารถเช็กได้ครับ ว่ากดปุ่มไหนอ่ะครับ
 แนะนำทีครับ
 
 ผมใส่แบบนี้ถูกต้องไหมครับพี่วิน
 
 Code (C#)
 
          private ImageButton Imageb;
        protected void Page_Load(object sender, EventArgs e)
        {
          
                Show_Table(Table1);
        
        }
        public void Show_Table(Table Table)
        {
            int row = 0;
            int rows = 0;
            int count = 0;
            int column=0;
            if (15 >= 1)
            {
                rows = (15) / 1;
                while (row < rows)
                {
                    TableRow tr = new TableRow();
                    while (column < 5)
                    {
                        TableCell tcell = new TableCell();
                        Table dataTable = new Table();
                      //  Button IB = new Button();
                        TableRow datarow1 = new TableRow();
                        TableRow datarow2 = new TableRow();
                        TableRow datarow3 = new TableRow();
                        TableCell datacell1_1 = new TableCell();
                        TableCell datacell2_1 = new TableCell();
                        TableCell datacell3_1 = new TableCell();
                        Imageb = new ImageButton();
                        Imageb.ImageUrl = "image/aa.bmp";
                        Imageb.ID = "ID" + count;
                     
                        datacell1_1.Controls.Add(Imageb);
                        Imageb.Click +=new ImageClickEventHandler(Imageb_Click);
                 
                            datarow1.Cells.Add(datacell1_1);
                            datarow1.BackColor = System.Drawing.Color.AliceBlue;
                            datarow2.Cells.Add(datacell2_1);
                            datarow2.BackColor = System.Drawing.Color.Aquamarine;
                            datarow3.Cells.Add(datacell3_1);
                            datarow3.BackColor = System.Drawing.Color.Brown;
                         //   dataTable.BorderStyle = WebControls.BorderStyle.Solid;
                            dataTable.BorderWidth = Unit.Pixel(2);
                            dataTable.Rows.Add(datarow1);
                            dataTable.Rows.Add(datarow2);
                            dataTable.Rows.Add(datarow3);
                         //   dataTable.BackColor = color_T;
                            dataTable.Width = Unit.Parse("100%");
                            dataTable.Height = Unit.Parse("250px");
                            dataTable.Attributes.Add("style", "table-layout:fixed");
                            dataTable.Font.Name = "verdana";
                            tcell.Controls.Add(dataTable);
                            tr.Cells.Add(tcell);
                        count = count + 1;
                        column = column + 1;
                    }
                    Table.Rows.Add(tr);
                    Table.Attributes.Add("style", "table-layout:fixed");
                    if (Table.Rows.Count > 0)
                    {
                        Table.Width = (250 * (Table.Rows[0].Cells.Count));
                        Table.Height = (250 * (Table.Rows.Count));
                    }
                    column = 0;
                    row=row+1;
               //        check = DirectCast((Table1.Rows(gg).FindControl("1chk" + hh.ToString())), CheckBox)
               
                }
            }
        }
  private void Imageb_Click(object sender, EventArgs e)
        {
//ดีบัคในนี้
        }
 |  
              | 
 ประวัติการแก้ไข
 2011-07-24 19:15:00
 2011-07-24 19:38:24
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-24 19:12:49 | By :
                            max |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ถ้าเป็นผม จะใช้การ Attribute ส่งค่า hidden ด้วยว่า ตอนนี้ปุ่มไหนที่ทำการ Click จะได้ตรวจสอบค่าได้ด้วย 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-24 19:16:09 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | แนะนำทีคร้าบ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-25 16:01:53 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เดียวพรุ่งนี้มาบอกแนวทางน่ะครับ วันนี้เหนื่อยมาก ๆ ครับ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-25 21:20:01 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขออนุญาต ดันนะครับ ใครพอทราบแนะนำทีครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 12:16:11 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | แป๊บครับ เดียวกลับมาอธิบายให้ครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 12:58:54 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับพี่วิน ^^ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 13:14:37 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | สร้าง hidden ไว้ใน page ที่เป็น .aspx 
 Code (C#)
 
 			Imageb.Attributes.Add("OnClick", "document.form1.hdnClickID.value="+count)
                        Imageb.Click +=new ImageClickEventHandler(Imageb_Click);
 ตอนที่ทำการ Click ที่ปุ่มก็ส่งค่าอะไรไปซะอย่างเพื่อให้รู้ว่าคลิกจากปุ่มไหน
 
 ตอนที่เรียกใช้ก็ check ได้เลยครับ
 
 Code (C#)
 
 protected void Imageb_Click()
{
  // Request.Form("hdnClickID")
}
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 13:27:47 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับพี่วิน ขอลองก่อนครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 13:35:12 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | คุณลองเปลี่ยน hidden เป็น text ดูครับ แล้วสังเกตุว่าตอนที่คลิกมันส่งค่าอะไรไปหรือเปล่าครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 14:23:38 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมใส่แบบนี้ถูกหรือป่าวครับพี่วิน Code (C#) 
   public void Show_Table(Table Table)
        {
            int row = 0;
            int rows = 0;
            int count = 0;
            int column=0;
            if (15 >= 1)
            {
                rows = (15) / 1;
                while (row < rows)
                {
                    TableRow tr = new TableRow();
                    while (column < 5)
                    {
                        TableCell tcell = new TableCell();
                        Table dataTable = new Table();
                      //  Button IB = new Button();
                        TableRow datarow1 = new TableRow();
                        TableRow datarow2 = new TableRow();
                        TableRow datarow3 = new TableRow();
                        TableCell datacell1_1 = new TableCell();
                        TableCell datacell2_1 = new TableCell();
                        TableCell datacell3_1 = new TableCell();
                        Imageb = new ImageButton();
                        Imageb.ImageUrl = "image/aa.bmp";
                        Imageb.ID = "ID" + count;
                     
                        datacell1_1.Controls.Add(Imageb);
                        Imageb.Attributes.Add("OnClick", "document.Default.hdnClickID.value=" + count);
                        Imageb.Click +=new ImageClickEventHandler(Imageb_Click);
                 
                            datarow1.Cells.Add(datacell1_1);
                            datarow1.BackColor = System.Drawing.Color.AliceBlue;
                            datarow2.Cells.Add(datacell2_1);
                            datarow2.BackColor = System.Drawing.Color.Aquamarine;
                            datarow3.Cells.Add(datacell3_1);
                            datarow3.BackColor = System.Drawing.Color.Brown;
                         //   dataTable.BorderStyle = WebControls.BorderStyle.Solid;
                            dataTable.BorderWidth = Unit.Pixel(2);
                            dataTable.Rows.Add(datarow1);
                            dataTable.Rows.Add(datarow2);
                            dataTable.Rows.Add(datarow3);
                         //   dataTable.BackColor = color_T;
                            dataTable.Width = Unit.Parse("100%");
                            dataTable.Height = Unit.Parse("250px");
                            dataTable.Attributes.Add("style", "table-layout:fixed");
                            dataTable.Font.Name = "verdana";
                            tcell.Controls.Add(dataTable);
                            tr.Cells.Add(tcell);
                        count = count + 1;
                        column = column + 1;
                    }
                    Table.Rows.Add(tr);
                    Table.Attributes.Add("style", "table-layout:fixed");
                    if (Table.Rows.Count > 0)
                    {
                        Table.Width = (250 * (Table.Rows[0].Cells.Count));
                        Table.Height = (250 * (Table.Rows.Count));
                    }
                    column = 0;
                    row=row+1;
               //        check = DirectCast((Table1.Rows(gg).FindControl("1chk" + hh.ToString())), CheckBox)
               
                }
            }
        }
แล้่วตอนคลิกผมจะดูได้ที่ไหนครับว่าส่งค่าอะไรไปครับ เพราะว่าปุ่ม มันถูกสร้างตาม row อ่ะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 14:52:02 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เอา code หน้า .aspx มาดูด้วยครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 15:04:55 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (ASP) 
 <head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <asp:Table ID="Table1" runat="server">
        </asp:Table>
    
    </div>
    </form>
</body>
</html>
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 15:15:08 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (C#) 
 <head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <asp:Table ID="Table1" runat="server">
	 <input type="hidden" name="hdnClickID" value="">
        </asp:Table>
    
    </div>
    </form>
</body>
</html>
 
 Code (C#)
 
 Imageb.Attributes.Add("OnClick", "document.form1.hdnClickID.value=" + count);
 แก้ชื่อ form ให้ถูกครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 15:23:27 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  ตอบความคิดเห็นที่ : 25 เขียนโดย : webmaster เมื่อวันที่ 2011-07-29 15:23:27 
 รายละเอียดของการตอบ ::
 error ครับพี่วิน
 
Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
 
Parser Error Message: System.Web.UI.WebControls.TableRowCollection must have items of type 'System.Web.UI.WebControls.TableRow'. 'input' is of type 'System.Web.UI.HtmlControls.HtmlInputHidden'.
 
Source Error:
 
Line 11:     <div> 
Line 12:          <asp:Table ID="Table1" runat="server"> 
Line 13: 	 <input type="hidden" name="hdnClickID" value=""> 
Line 14:         </asp:Table> 
Line 15:     
 
Source File: /Default.aspx    Line: 13 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 15:29:21 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลองใหม่ครับ 
 Code (C#)
 
 <head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <asp:Table ID="Table1" runat="server">
	 <input id="hdnClickID" type="hidden" runat="server" />
        </asp:Table>
    
    </div>
    </form>
</body>
</html>
 
 Code (C#)
 
 Imageb.Attributes.Add("OnClick", "document.form1." + this.hdnClickID.ClientID() + ".value=" + count);
 
 Code (C#)
 
 	protected void Imageb_Click()
	{
		  if(this.hdnClickID.Text == "xxx")
		  {
			
		  }
	}
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 15:52:30 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ใส่แล้ว error 3 ที่ครับ ที่แรก error ตรง hdnClickID.Text Code (C#)
 
 protected void Imageb_Click()
{
	  if(this.hdnClickID.Text == "xxx")
	  {
		
	  }
}
 ทีี่ 2 error ตรง hdnClickID.ClientID()
 Code (C#)
 
    Imageb.Attributes.Add("OnClick", "document.form1." + this.hdnClickID.ClientID() + ".value=" + count); 
             
 ที่ 3 error ตรง  new ImageClickEventHandler(Imageb_Click);
 Code (C#)
 
      Imageb.Click += new ImageClickEventHandler(Imageb_Click);
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 16:17:58 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ส่ง code มาให้หน่อยครับ จะได้ช่วยดูให้ครับ 
 thaicreate at hotmail dot com ทำการ zip มาน่ะครับ บอกรุ่นของ Visual Studio ด้วยครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 16:44:52 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับพี่วินl ส่งให้แล้วนะครับ 
 |  
              | 
 ประวัติการแก้ไข
 2011-07-29 16:54:15
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 16:45:36 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เขียนให้แล้วครับรันผ่านเรียบร้อย 
 Code (Default.aspx)
 
 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:HiddenField ID="hdnClickID" runat="server" />
        <asp:Label ID="lblDisplay" runat="server" Text=""></asp:Label>
        <asp:Table ID="Table1" runat="server" />       
    </div>
    </form>
</body>
</html>
 Code (Default.aspx.cs)
 
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        private ImageButton Imageb;
        protected void Page_Load(object sender, EventArgs e)
        {
           Show_Table(this.Table1);
        }
        public void Show_Table(Table Table)
        {
            int row = 0;
            int rows = 0;
            int count = 0;
            int column = 0;
            if (15 >= 1)
            {
                rows = (15) / 1;
                while (row < rows)
                {
                    TableRow tr = new TableRow();
                    while (column < 5)
                    {
                        TableCell tcell = new TableCell();
                        Table dataTable = new Table();
                        //  Button IB = new Button();
                        TableRow datarow1 = new TableRow();
                        TableRow datarow2 = new TableRow();
                        TableRow datarow3 = new TableRow();
                        TableCell datacell1_1 = new TableCell();
                        TableCell datacell2_1 = new TableCell();
                        TableCell datacell3_1 = new TableCell();
                        Imageb = new ImageButton();
                        Imageb.ImageUrl = "icon.gif";
                        Imageb.ID = "ID" + count;
                        datacell1_1.Controls.Add(Imageb);
                        Imageb.Attributes.Add("OnClick", "document.getElementById('" + this.hdnClickID.ClientID + "').value=" + count + "");
                        Imageb.Click += new ImageClickEventHandler(Imageb_Click);
                        datarow1.Cells.Add(datacell1_1);
                        datarow1.BackColor = System.Drawing.Color.AliceBlue;
                        datarow2.Cells.Add(datacell2_1);
                        datarow2.BackColor = System.Drawing.Color.Aquamarine;
                        datarow3.Cells.Add(datacell3_1);
                        datarow3.BackColor = System.Drawing.Color.Brown;
                        //   dataTable.BorderStyle = WebControls.BorderStyle.Solid;
                        dataTable.BorderWidth = Unit.Pixel(2);
                        dataTable.Rows.Add(datarow1);
                        dataTable.Rows.Add(datarow2);
                        dataTable.Rows.Add(datarow3);
                        //   dataTable.BackColor = color_T;
                        dataTable.Width = Unit.Parse("100%");
                        dataTable.Height = Unit.Parse("250px");
                        dataTable.Attributes.Add("style", "table-layout:fixed");
                        dataTable.Font.Name = "verdana";
                        tcell.Controls.Add(dataTable);
                        tr.Cells.Add(tcell);
                        count = count + 1;
                        column = column + 1;
                    }
                    Table.Rows.Add(tr);
                    Table.Attributes.Add("style", "table-layout:fixed");
                    if (Table.Rows.Count > 0)
                    {
                        Table.Width = (250 * (Table.Rows[0].Cells.Count));
                        Table.Height = (250 * (Table.Rows.Count));
                    }
                    column = 0;
                    row = row + 1;
                    //        check = DirectCast((Table1.Rows(gg).FindControl("1chk" + hh.ToString())), CheckBox)
                }
            }
        }
        private void Imageb_Click(object sender, EventArgs e)
        {
            this.lblDisplay.Text = "Your selected button : " + this.hdnClickID.Value;
        }
    }
}
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 17:51:07 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับพี่วิน ไปลองก่อนครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 18:05:50 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ได้ไม่ได้ยังไงบอกด้วยน่ะครับ ว่าแต่จะทำอะไรครับ ถึงได้ออกแบบ มาแบบนี้ครับ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 18:07:21 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณมากครับพี่วิน ได้แล้วครับ ผมจะทำเว็บขายสินค้าครับ ให้แสดงรูปและรายละเอียดสินค้าใส่ table ครับ ถ้าสนใจก็คลิกที่รูปสินค้า ประมาณนี้ครับ
 
 ตอนแรกใช้ gridview ทำ แล้วรูปสินค้ามันเรียงลงด้านล่างครับ มันไม่สวยเท่าไร ^^
 
 หรือมันมีอะไรที่ดีกว่านี้หรือป่าวครับพี่วิน
 
 ยังไงก็ขอบคุณมากครับ สุดยอดเลย เด๋วนี้หายากแล้วครับคนที่ช่วยขนาดนี้ ^^
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-29 18:21:45 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับพี่วิน เด๋วไปหัดเล่นครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-07-30 11:44:25 | By :
                            sodamax |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |