c# - (createchildcontrole) = object reference not set to an instance of an object -


i use visual studio 2012 create usercontrols wrapped on sharepoint 2010 following code of 1 of them

    public partial class sidebarusercontrol : system.web.ui.usercontrol {     protected void page_load(object sender, eventargs e)     {         lilogout.visible = false;         attendance.visible = false;         empevaluation.visible = false;         objections.visible = false;         myeval.visible = false;         rates.visible = true;         if (pagebase.currentuser == null)         {             string loginname = spcontext.current.web.currentuser.loginname;             loginname = loginname.split(new string[] { "\\" }, stringsplitoptions.removeemptyentries)[1];              if (systemuserbll.isuserexist(loginname, "123456"))             {                 systemuserbll.login(loginname, "123456");             }             else                 response.redirect("login.aspx", true);         }          if (new userdal().getuserfieldvalue(pagebase.currentuser.id, 51).fieldvalue == "الدرجة الثانية")         {             rates.visible = false;             syssettings.visible = false;             reports.visible = false;             string employeetype = new userdal().getuserfieldvalue(pagebase.currentuser.id, 39).value;             myeval.visible = false;              if (employeetype == "2") // employee             {                 if (!request.path.tolower().contains("rateform.aspx") && !request.path.tolower().contains("myevaluation.aspx")                     && !request.path.tolower().contains("homepage.aspx"))                     response.redirect("myevaluation.aspx");                 myeval.visible = true;                  objections.visible = false;                 empevaluation.visible = false;             }             else if (employeetype == "3") // wakeel             {                 if (!request.path.tolower().contains("rateform.aspx") && !request.path.tolower().contains("objections.aspx") && !request.path.tolower().contains("userevaluation.aspx")                     && !request.path.tolower().contains("homepage.aspx") && !request.path.tolower().contains("percentages.aspx")                     && !request.path.tolower().contains("userattendance.aspx"))                     response.redirect("userevaluation.aspx");                  rates.visible = false;                 objections.visible = true;                 empevaluation.visible = true;                 attendance.visible = true;                 myeval.visible = false;                  syssettings.visible = true;                 form.visible = false;                 waitperiod.visible = false;             }             else // manager             {                 if (!request.path.tolower().contains("rateform.aspx") && !request.path.tolower().contains("myevaluation.aspx")                     && !request.path.tolower().contains("objections.aspx") && !request.path.tolower().contains("userevaluation.aspx")                     && !request.path.tolower().contains("homepage.aspx") && !request.path.tolower().contains("userattendance.aspx"))                     response.redirect("userevaluation.aspx");                 //myeval.visible = false;                  rates.visible = false;                 myeval.visible = true;                 objections.visible = true;                 empevaluation.visible = true;                 attendance.visible = true;             }              agenciesmanagers.visible = false;         }     } } 

when try run on sharepoint runs , have following error

(createchildcontrole) = object reference not set instance of object 

if error occurred refreshing page solving problem

any help?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -