"Edit Update Cancel"명령 필드가있는 gridview가 있습니다. 편집을 클릭하면 특정 행의 모든 열이 편집 가능 해지고 업데이트를 클릭하면 표가 새 값을 기반으로 업데이트됩니다. 그런 다음 Gridview는 업데이트 된 데이터 테이블로 바인드됩니다. 그러나 여전히 "업데이트 취소"버튼이 남아 있습니다 . 행 일단 업데이트 후 정상 모드로 행을 작성해야합니다.
는 버튼을 "편집"어떻게하는 것이 가능하게되어 변경되어야한다 "업데이트 취소"업데이트되었습니다. 미리덕분
이
protected void StaticNoticeGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
//Gets the updated value from GridView
string id = StaticNoticeGridView.Rows[e.RowIndex].Cells[0].Text;
string updatedItem = e.NewValues[0].ToString();
string updatedURL = e.NewValues[1].ToString();
//Updated the Database
StaticNoticeController staticNoticeController = new StaticNoticeController();
int rocordsAffected = staticNoticeController.UpdateStaticNoticeData(updatedItem, updatedURL, id);
//Gets the updated datatable and binds the Gridview again
if (rocordsAffected == 1)
{
this.StaticNoticeGridView.DataSource = null;
this.StaticNoticeGridView.DataSource = staticNoticeController.GetStaticNoticeData();
this.StaticNoticeGridView.DataBind();
}
}
catch(SystemException ex)
{
//ToDo: Log the Exception
}
}
코드를 보여주세요 전 업데이트 클릭 이벤트 핸들러에 사용합니다. – Hogan
@Hogan Thanks .. 코드가 질문에 추가되었습니다. – Ananth