Esempio n. 1
0
    //method to select data on edit
    private void BindSelected(string strUserName)
    {
        objUserMaster.BindUseronUserName(strUserName, "SELECT_USER_BY_USRNAME");
        txtUserEmailId.Text = objUserMaster.EmailId;
        txtUsername.Text    = strUserName;
        txtName.Text        = objUserMaster.Name;
        // Code for selecting Status as in database
        for (intCnt = 0; intCnt < ddlUserType.Items.Count; intCnt++)
        {
            if (ddlUserType.Items[intCnt].Value.ToString().Trim() == objUserMaster.UserType.ToString().Trim())
            {
                ddlUserType.SelectedIndex = intCnt;
            }
        }

        for (intCnt = 0; intCnt < ddlRegion.Items.Count; intCnt++)
        {
            if (ddlRegion.Items[intCnt].Value.ToString().Trim() == objUserMaster.Region.ToString().Trim())
            {
                ddlRegion.SelectedIndex = intCnt;
                objCommonClass.BindUserBranchBasedOnRegion(ddlBranch, int.Parse(objUserMaster.Region.ToString()));
                break;
            }
        }


        for (intCnt = 0; intCnt < ddlBranch.Items.Count; intCnt++)
        {
            if (ddlBranch.Items[intCnt].Value.ToString().Trim() == objUserMaster.Branch.ToString().Trim())
            {
                ddlBranch.SelectedIndex = intCnt;
                break;
            }
        }

        for (intCnt = 0; intCnt < ddlProductDivision.Items.Count; intCnt++)
        {
            if (ddlProductDivision.Items[intCnt].Value.ToString().Trim() == objUserMaster.unit_sno.ToString().Trim())
            {
                ddlProductDivision.SelectedIndex = intCnt;
                break;
            }
        }
        // Code for selecting Status as in database
        for (intCnt = 0; intCnt < rdoStatus.Items.Count; intCnt++)
        {
            if (rdoStatus.Items[intCnt].Value.ToString().Trim() == objUserMaster.ActiveFlag.ToString().Trim())
            {
                rdoStatus.Items[intCnt].Selected = true;
            }
            else
            {
                rdoStatus.Items[intCnt].Selected = false;
            }
        }
        hdnEditType.Value = "Edit";
        Selection();
        if (trTvtUserid.Visible)
        {
            txtTvtUserId.Text = Convert.ToString(objUserMaster.TvtUserId);
        }
    }