When you add a label to the DataGrid, you assign a value to the label

Source: Internet
Author: User
1: You can directly in the design page to the label text bound to the field you want
2: You can find the label inside the ItemDataBound E.item.findcontrol
and assign it a value.
protected void Datagrid1_itemdatabound (Object Sender,system.web.ui.webcontrols.datagriditemeventargs e)
{

if (e.item.itemtype==listitemtype.item| | E.item.itemtype==listitemtype.alternatingitem)
{

String MessageID = (string) e.item.cells[0]. Text;
Label Lab = (label) E.item.findcontrol ("Label1");
Lab. Text= "...";


}

}

foreach (DataGridItem item in this. Datagrid1.items)
{
String strpiece= (TextBox) item. FindControl ("Edit_piece")). Text.trim (). ToString ();
TextBox TextBox1 = Item. FindControl ("TextBox1");
textbox1.text= Convert.ToInt32 (strpiece) *33;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.