page_load时条件不适用... [英] condition not applying while page_load...

查看:63
本文介绍了page_load时条件不适用...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要为管理员和普通用户提供白页的条件.

condition i am giving while page for admin and normal users.

if (Role == "Admin")
                    {
                        btnUpdate.Visible = true;
                        btnSubmit.Visible = false;
                    }
                    else
                    {

                        btnUpdate.Visible = false;
                        btnSubmit.Visible = true;

                    } 
//but its taking as normal because of sEmpcode.any solution is possible.... 

protected void grdJobHistory_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (Convert.ToString(Request.QueryString["empcode"].ToString()) != "")
        {


            if (Request.QueryString["comcode"].ToString() == "MEHTASCL")
            {
               

                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    string comcode = Request.QueryString["comcode"].ToString();
                    string sAEmpCode = Request.QueryString["empcode"].ToString();
                    string sEmpCode = Convert.ToString(e.Row.Cells[0].Text);
                    string sProbId = Convert.ToString(e.Row.Cells[8].Text);

                    if (e.Row.Cells[11].Text == "")
                    {
                        HyperLink h1 = e.Row.FindControl("Hyperlink1") as HyperLink;
                        string sUrl = "~/Submit.aspx";
                        
                        sUrl += "?empcode=" + sEmpCode.Trim();
                        sUrl += "&aempcode=" + sAEmpCode.Trim();
                        sUrl += "&comcode=" + comcode.Trim();
                        sUrl += "&probid=" + sProbId.Trim();

                        h1.NavigateUrl = ResolveUrl(sUrl);

                    }
                }
            }
        }
    }



/////////////////////////////////////////////////////////////
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {


            Library lib = new Library();
            string Role = "";
            string sValue = lib.setCompanyCode("mcl", "rnv", "4", 1);


            if (Request.QueryString["empcode"].ToString() != "" && Request.QueryString["empcode"].ToString() != null)
            {

                if (Request.QueryString["comcode"].ToString() == "MCL")
                {

                    string sEmpCode = Request.QueryString["empcode"].ToString();
                    string sAEmpCode = Request.QueryString["empcode"].ToString();
                    Role = lib.getEmpRole("mehtascl", "rnv", Request.QueryString["empcode"].ToString());

                    if (Role == "Admin")
                    {
                        btnUpdate.Visible = true;
                        btnSubmit.Visible = false;
                    }
                    else
                    {

                        btnUpdate.Visible = false;
                        btnSubmit.Visible = true;

                    }
                    if (Request.QueryString["probid"] != null)
                        {


                            string sProbId = Request.QueryString["probid"].ToString();

                            DataTable dtProblemDetail = lib.getDetailByProblemId("MCL", "RNV", sProbId);
                            ddrDepartment.SelectedValue = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[5]).Trim();
                            ddrarea.SelectedValue = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[6]).Trim();
                            ddrCatagory.SelectedValue = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[7]).Trim();
                            ddrSubCatagory.SelectedValue = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[8]).Trim();
                            txtTitle.Value = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[9]).Trim();
                            txtDescription.Value = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[10]).Trim();
                            string sStatus = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[11]).Trim();
                            txtsolution.Value = Convert.ToString(dtProblemDetail.Rows[0].ItemArray[12]).Trim();

                            sStatus = sStatus.ToUpper();
                            for (int iCnt = 0; iCnt < ddrStatus.Items.Count; iCnt++)
                            {
                                if (ddrStatus.Items[iCnt].ToString() == sStatus)
                                {
                                    ddrStatus.SelectedIndex = iCnt;
                                    break;
                                }
                            }
                        }

                        DataTable dtUserDetail = this.getUserDetail("Mcl", sEmpCode.Trim());
                        DataTable dtDesination = this.getEmpDesignation("Mcl", sEmpCode.Trim());

                        txtEmpCode.Text = sEmpCode;
                        lblEmpName.Text = dtUserDetail.Rows[0].ItemArray[0].ToString() + " " + dtUserDetail.Rows[0].ItemArray[1].ToString() + " " + dtUserDetail.Rows[0].ItemArray[2].ToString();
                        lblDesignation.Text = dtDesination.Rows[0].ItemArray[0].ToString();


                    }
                
                }
            }
       }

推荐答案



能否请您说一下什么在这里行不通或者是什么问题.不清楚. :)
Hi,

can you please mention what is not working here or what is the problem. It not clear. :)


这篇关于page_load时条件不适用...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆