protected void grdAgentSearch_ItemCommand(object sender, GridCommandEventArgs e) { try { if (e.CommandName == "Select") { GridDataItem dataitem = e.Item as GridDataItem; DataTable dt1 = com.SelectParamData("CASE10", dataitem["AGENTID"].Text, "", "", ""); grdAgentSearch.DataSource = dt1; lblID.Text = dt1.Rows[0]["AGENTID"].ToString(); txtAgentCode.Text = dt1.Rows[0]["AGENT_CODE"].ToString(); txtDes.Text = dt1.Rows[0]["AGENT_DESCRIPTION"].ToString(); CmbLevel.Items.Clear(); CmbLevel.DataSource = com.SelectType("AGENT_LEVEL"); CmbLevel.DataValueField = "AGENT_LEVEL"; CmbLevel.DataTextField = "LEVEL_DESCRIPTION"; CmbLevel.DataBind(); CmbLevel.Items.Insert(0, new RadComboBoxItem(dt1.Rows[0]["LEVEL_DESCRIPTION"].ToString(), dt1.Rows[0]["AGENT_LEVEL"].ToString())); CmbStatus.Items.Insert(0, new RadComboBoxItem(dt1.Rows[0]["STATUS"].ToString(), dt1.Rows[0]["STATUS"].ToString())); BtnInsert.Enabled = false; BtnUpdate.Enabled = true; } } catch (Exception ex) { lblError.Text = ex.Message; lblError.Visible = true; return; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { UserName = User.Identity.Name; if (Left(UserName, 4) == "HNBA") { UserName = Right(UserName, (UserName.Length) - 5); Session["USER"] = UserName; GetUser(UserName.ToString()); } else if (Left(UserName, 5) == "HNBGI") { UserName = Right(UserName, (UserName.Length) - 6); Session["USER"] = UserName; GetUser(UserName.ToString()); } CmbLevel.Items.Clear(); CmbLevel.DataSource = com.SelectType("AGENT_LEVEL"); CmbLevel.DataValueField = "AGENT_LEVEL"; CmbLevel.DataTextField = "LEVEL_DESCRIPTION"; CmbLevel.DataBind(); CmbStatus.Items.Clear(); CmbStatus.Items.Insert(0, new RadComboBoxItem("ACTIVE", "ACTIVE")); CmbStatus.Items.Insert(1, new RadComboBoxItem("INACTIVE", "INACTIVE")); grdAgentSearch.DataSource = new int[] { }; } } catch (Exception ex) { lblError.Text = ex.Message; lblError.Visible = true; return; } }