Dynamically bind DROPDOWNLIST in DataGrid

xiaoxiao2021-03-05  25

IF (E.Item.ItemType == ListItemType.editItem)

{

DataRowView DRV = (DATAROWVIEW) E.Item.DataItem;

String CurrentValue = DRV ["Cur_ID"]. TOSTRING ();

DropDownList DDL = (DropDownList) E.Item.FindControl ("DDL_CurInfo");

DataTable Table = Readcurinfo ();

DDL.DataSource = Table;

DDL.DATATEXTFIELD = "cur_chname";

DDL.DataValuefield = "CUR_ID";

DDL.DATABIND ();

DDL.Items.Insert (0, New ListItem ("Please select", ""));

Ddl.selectedIndex = ddl.Items.indexof (DDL.Items.FindByValue (CurrentValue);

}

IF (E.Item.ItemType == ListItemType.alternatingItem || E.Item.ItemType == ListItemType.Item)

{

HyperLink HPL = (HyperLink) E.Item.FindControl ("HPY_ATTCH");

DataRowView DRV = (DATAROWVIEW) E.Item.DataItem;

String FileAttch = DRV ["oonmana_appendfile"]. TOSTRING ();

HPL.NAVIGATEURL = FileAttch;

Hpl.text = fileAttch.substring (FileAttch.lastIndexof (@ "/") 1);

}

转载请注明原文地址:https://www.9cbs.com/read-34668.html

New Post(0)