Example #1
0
        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());
                    }
                    CmbRefTypeSrch.Items.Clear();
                    CmbRefTypeSrch.DataSource     = com.SelectType("REF_TYPE");
                    CmbRefTypeSrch.DataValueField = "PARAMID";
                    CmbRefTypeSrch.DataTextField  = "PARAMDESCRIPTION";
                    CmbRefTypeSrch.DataBind();
                    CmbRefTypeSrch.Items.Insert(0, new RadComboBoxItem("--Select Type--", ""));

                    CmbRefType.Items.Clear();
                    CmbRefType.DataSource     = com.SelectType("REF_TYPE");
                    CmbRefType.DataValueField = "PARAMID";
                    CmbRefType.DataTextField  = "PARAMDESCRIPTION";
                    CmbRefType.DataBind();
                    CmbRefType.Items.Insert(0, new RadComboBoxItem("--Select Type--", ""));
                }
            }
            catch (Exception ex)
            {
                lblError.Text    = ex.Message;
                lblError.Visible = true;
                return;
            }
        }
Example #2
0
        protected void grdRefSearch_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Select")
                {
                    GridDataItem dataitem = e.Item as GridDataItem;

                    DataTable dt2 = com.SelectParamData("CASE4", dataitem["ID"].Text, txtDesSearch.Text, "", "");
                    grdRefSearch.DataSource = dt2;
                    grdRefSearch.DataBind();

                    BtnInsert.Enabled = false;

                    lblID.Text   = dt2.Rows[0]["ID"].ToString();
                    txtCode.Text = dt2.Rows[0]["CODE"].ToString();
                    txtDes.Text  = dt2.Rows[0]["DESCRIPTION"].ToString();

                    if (dt2.Rows[0]["REF_TYPE"].ToString() != "")
                    {
                        CmbRefType.Items.Clear();
                        CmbRefType.DataSource     = com.SelectType("REF_TYPE");
                        CmbRefType.DataValueField = "PARAMID";
                        CmbRefType.DataTextField  = "PARAMDESCRIPTION";
                        CmbRefType.DataBind();
                        CmbRefType.Items.Insert(0, new RadComboBoxItem(dt2.Rows[0]["PARAMDESCRIPTION"].ToString(), dt2.Rows[0]["REF_TYPE"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text    = ex.Message;
                lblError.Visible = true;
                return;
            }
        }