2012-08-13 40 views

回答

1

您可以在標籤的動態標籤和數據綁定事件設置值綁定中添加標籤。 將所有有界值設置在數據表中,它將幫助您在此事件上設置正確的值。

protected void gdvCustomer_DataBound(object sender, EventArgs e) 
     { 
      AddLabel(); 
     } 


     /// 
     /// Add a Label To GridView Row. 
     /// 
     private void AddLabel() 
     { 
      foreach (GridViewRow row in gdvCustomer.Rows) 
      { 
      a++;//row number 
       if (row.RowType == DataControlRowType.DataRow) 
       { 
        for (i =0;iyou can also take value from a datatable 
        //or lb.Text = yourdatatable.Rows[a][i]; 
        row.Cells[0].Controls.Add(lb); 
        } 
       } 
      } 
     } 
+0

AddLinkBut​​ton()的意思是AddLabel(),對不對? – 2012-08-13 18:21:27

+0

正確的我糾正它 – 2012-08-13 18:23:11

+0

高興地幫助你我的朋友;-) – 2012-08-13 18:28:06

相關問題