protected void lnkbtnEdit_Click(object sender, EventArgs e) { try { LinkButton lnkbtn = sender as LinkButton; GridViewRow gvrow = lnkbtn.NamingContainer as GridViewRow; int examid = Convert.ToInt32(gvExamDetail.DataKeys[gvrow.RowIndex].Value.ToString()); DataTable table = new DataTable(); table = _baexmmng.SelectExamDetailWithID("GetExamWithId", examid); if (table.Rows.Count > 0) { ViewState["examId"] = table.Rows[0]["ExamCodeId"].ToString(); txtExamCode.Text = table.Rows[0]["ExamCode"].ToString(); txtExamCode.Enabled = false; txtExamtitle.Text = table.Rows[0]["ExamTitle"].ToString(); drpTopCategory.SelectedValue = table.Rows[0]["TopCategoryId"].ToString(); FilldropDownSecondCategory(drpTopCategory.SelectedItem.Value); drpSecondCategory.SelectedValue = table.Rows[0]["SecondCategoryId"].ToString(); txtPassingPercentage.Text = table.Rows[0]["PassingPercentage"].ToString(); txtTestTime.Text = table.Rows[0]["TestTime"].ToString(); txtTestOption.Text = table.Rows[0]["TestOption"].ToString(); DateTime date = Convert.ToDateTime(table.Rows[0]["ValidDate"]); txtdate.Text = date.ToString("yyyy-MM-dd"); btnAdd.Text = "Update"; lnkbtnAdd.Text = "Update"; lnkbtnAdd.OnClientClick = String.Format("return getConfirmation(this,'{0}','{1}');", "Please confirm", "Are you sure you want to update this record?"); } } catch (Exception ex) { Common.LogError(ex); ShowMessage("Some technical error", MessageType.Warning); } }
private void GetExamDetail(string examid) { BAExamManage _baexmmng = new BAExamManage(); DataTable _datatable = new DataTable(); _datatable = _baexmmng.SelectExamDetailWithID("GetExamWithId", Convert.ToInt32(examid)); if (_datatable.Rows.Count > 0) { lblExamName.Text = _datatable.Rows[0]["SecondCategoryName"].ToString() + " " + _datatable.Rows[0]["ExamCode"].ToString(); dlexamdetail.DataSource = _datatable; dlexamdetail.DataBind(); } }