Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
condition i am giving while page for admin and normal users.

C#
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();


                    }
                
                }
            }
       }
Posted
Updated 9-May-10 19:04pm
v3
Comments
Sandeep Mewara 10-May-10 1:22am    
What is your problem? Please update the question clarifying the issue and highlighting/using important code snippets instead of all.

1 solution

Hi,

can you please mention what is not working here or what is the problem. It not clear. :)
 
Share this answer
 
Comments
Ankur\m/ 10-May-10 1:31am    
Sandeep has already said this in the comment. :)
Arindam Tewary 10-May-10 2:25am    
hmm ... When I started I didn't find any post/comment added to it. Otherwise I would have keep myself away putting answer. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900