コード例 #1
0
 protected void grdAnswer_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName.Equals("Delete"))
         {
             AnswerMaster blog = new AnswerMaster();
             int index = Convert.ToInt32(e.CommandArgument);
             GridViewRow row = grdAnswer.Rows[index];
             HiddenField hdnField = (HiddenField)row.FindControl("hdnGUID");
             blog.deleteAnswerByAnswerId(new Guid(hdnField.Value.ToString()));
             bindAnswers();
         }
         if (e.CommandName.Equals("Edit"))
         {
             int index = Convert.ToInt32(e.CommandArgument);
             GridViewRow row = grdAnswer.Rows[index];
             HiddenField hdnField = (HiddenField)row.FindControl("hdnGUID");
             Response.Redirect("ManageAnswer.aspx?guid=" + new Guid(hdnField.Value.ToString()) + "&blogId=" + new Guid(Request.QueryString["blogId"].ToString()));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 private void bindAnswers()
 {
     AnswerMaster blog = new AnswerMaster();
     try
     {
         blog.BLOGID = new Guid(Request.QueryString["blogId"]);
         grdAnswer.DataSource = blog.getAllAnswer();
         grdAnswer.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         blog = null;
     }
 }