Example #1
0
        protected void RgvAddRole_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            try
            {
                LRRRlblRoleResult.Visible = false;
                RlblRoleResult.Text       = string.Empty;
                if (e.CommandName == "ViewSMSTemp")
                {
                    GridDataItem ditem = (GridDataItem)e.Item;
                    e.Item.Selected = true;
                    string ID = e.CommandArgument.ToString();
                    ViewState["IDAddRoleTemp"] = string.Empty;
                    Label lbCampusID = (Label)ditem.FindControl("lbCampusID");

                    string campusid = string.Empty;
                    campusid = Convert.ToString(lbCampusID.Text);

                    DataTable dtshowTemplate = DataAccessManager.GetRoleById(ID, campusid);
                    if (dtshowTemplate.Rows.Count > 0)
                    {
                        RtxtRoleCode.Text          = Convert.ToString(dtshowTemplate.Rows[0]["Role_Id"]);
                        txtRoleName.Text           = Convert.ToString(dtshowTemplate.Rows[0]["Role"]);
                        Rddlcampus.SelectedValue   = Convert.ToString(dtshowTemplate.Rows[0]["CampusID"]);
                        RPbtnSave.Text             = "Update";
                        ViewState["IDAddRoleTemp"] = ID;
                        ViewState["updateCampuID"] = Convert.ToString(dtshowTemplate.Rows[0]["CampusID"]);

                        RtxtRoleCode.Enabled = false;
                    }
                }


                if (e.CommandName == "DeleteSMSTemp")
                {
                    GridDataItem ditem = (GridDataItem)e.Item;
                    e.Item.Selected = true;
                    string DeleteID = e.CommandArgument.ToString();
                    ViewState["IDSMSTemp"] = string.Empty;
                    Boolean result = false;
                    result = DataAccessManager.DeleteAddRoleDB(DeleteID);
                    if (result == true)
                    {
                        RtxtRoleCode.Text = string.Empty;
                        RPbtnSave.Text    = "Save";
                        txtRoleName.Text  = string.Empty;
                        //   BindRole();
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "Login Result", "alert('Delete successfully!');", true);
                        RtxtRoleCode.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }