コード例 #1
0
 /// <summary>
 /// Các thao tác trên danh sách
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void grvDocumentKind_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("cmdEdit", StringComparison.OrdinalIgnoreCase))
     {
         BDocumentKind ctl = new BDocumentKind();
         ODocumentKind obj = ctl.Get(int.Parse(e.CommandArgument.ToString())).First();
         if (obj != null)
         {
             txtDescription.Text = obj.Description;
             txtName.Text        = obj.Name;
             hdfId.Value         = obj.DocumentKindID.ToString();
             try
             {
                 ddlParent.ClearSelection();
                 ddlParent.Items.FindByValue(obj.DocumentKindParent.ToString()).Selected = true;
             }
             catch (Exception ex) { }
         }
     }
     else if (e.CommandName.Equals("cmdDelete", StringComparison.OrdinalIgnoreCase))
     {
         BDocumentKind ctl = new BDocumentKind();
         if (ctl.Delete(int.Parse(e.CommandArgument.ToString())))
         {
             BindData();
         }
         else
         {
             RegisterClientScriptBlock("Notification", "<script language='javascript'>alert('Đã tồn tại văn bản trong loại này!');</script>");
         }
     }
 }