コード例 #1
0
        //GridFund_ItemCommand event is use for two command name edit and delete
        protected void GridFund_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            string FundNumber;

            //if  command name is EditFund of fund it will get the id of particuar
            //row to edit the fund and redirecte it to newfund screen to update that fund
            if (e.CommandName == "EditFund")
            {
                if (e.Item is GridDataItem)
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    FundNumber = item["FundNumber"].Text.ToString().Trim();

                    Response.Redirect("~/UserScreens/Addnewfund.aspx?FID=" + FundNumber);
                }
            }
            //If command name is delete it will get the id that fund which needs to be deleted by calling DELETEFund
            //it will successfully get deleted
            else if (e.CommandName == "Delete")
            {
                GridDataItem item = (GridDataItem)e.Item;
                objfund.Fundnumber = Convert.ToInt32(item["FundNumber"].Text.ToString());

                no_of_rows_affected = objfund.DELETEFund();
                if (no_of_rows_affected == 1)
                {
                    Validations.showMessage(lblErrorMsg, "Fund " + Validations.RecordDeleted, "");
                    BindGrid();
                }
                else
                {
                    Validations.showMessage(lblErrorMsg, "Fund " + Validations.Err_RefDelete, "Error");
                }
            }
        }