Hi May I know whether I can do the same with DataList as in DetailsView programmatically ? myDetailsView.ChangeMode(DetailsViewMode.Edit); Thanks Peter
On 3 Jul., 15:54, "Peter" wrote: > Hi > > May I know whether I can do the same with DataList as in DetailsView programmatically ? > > myDetailsView.ChangeMode(DetailsViewMode.Edit); > > Thanks > Peter To show Edit mode DataList uses EditItemTemplate and EditItemIndex. By default, the value of EditItemIndex is -1, meaning none of the items in the list is being edited. When EditItemIndex is set to a particular item, that item is displayed using the EditItemTemplate. Set EditItemIndex to any item, bind the DataList again and your list will be switched to Edit mode. Also you can just add an edit button with CommandName="edit" and specify OnEditCommand to switch DataList in to the Edit mode: http://msdn.microsoft.com/en-us/library/90xwe9s3.aspx Hope this helps
"Alexey Smirnov" wrote in message news:ae75bf8f-dbc3-42d4-9b5c-0baa240cbace@t13g2000yqt.googlegroups.com... > On 3 Jul., 15:54, "Peter" wrote: >> Hi >> >> May I know whether I can do the same with DataList as in DetailsView programmatically ? >> >> myDetailsView.ChangeMode(DetailsViewMode.Edit); >> >> Thanks >> Peter > > To show Edit mode DataList uses EditItemTemplate and EditItemIndex. By > default, the value of EditItemIndex is -1, meaning none of the items > in the list is being edited. When EditItemIndex is set to a particular > item, that item is displayed using the EditItemTemplate. Set > EditItemIndex to any item, bind the DataList again and your list will > be switched to Edit mode. > > Also you can just add an edit button with CommandName="edit" and > specify OnEditCommand to switch DataList in to the Edit mode: > http://msdn.microsoft.com/en-us/library/90xwe9s3.aspx > > Hope this helps Thanks Alexey..will give it a try. Peter