protected void btnSave_Click(object sender, EventArgs e) { TextBox captionText = new TextBox(); TextBox locationText = new TextBox(); TextBox despText = new TextBox(); GMDatePicker datep = new GMDatePicker(); string caption = null; string location = null; string desp = null; string id = null; DateTime adddate; foreach (DataListItem dataItem in DataList1.Items) { captionText = (TextBox)dataItem.FindControl("txtCaption"); captionText = (TextBox)dataItem.FindControl("txtCaption"); locationText = (TextBox)dataItem.FindControl("txtLocation"); datep = (GMDatePicker)dataItem.FindControl("GMDatePicker1"); //despText = (TextBox)dataItem.FindControl("txtDescription"); caption = captionText.Text.ToString().Trim(); location = locationText.Text.ToString().Trim(); //desp = despText.Text.ToString().Trim(); adddate = datep.Date; string Id = ((HiddenField)dataItem.FindControl("HiddenField1")).Value; MediaBO objClass = new MediaBO(); objClass.Id = Id; objClass.Location = location; objClass.Caption = caption; objClass.AddedDate = adddate; objClass.Type = Global.PHOTO; MediaBLL.updateEditMedia(objClass); } EditAlbum(); LoadDataListMedia(); LoadDataAlbum(); }