c# - Asp.net visible button when 2 parameters match -


hello want make button visibile when userid stored in database match current userid.

            string clientid = context.user.identity.getuserid();              jobdescriptions job = new jobdescriptions();              if (job.postedby == clientid)             {                 button2.visible = true;             else              {                 button2.visible = false;             } 

postedby id of user posted on website saved on jobs table. problem button not visibile when statement should work.

the solution

if (!string.isnullorwhitespace(request.querystring["id"]))             {                 int id = convert.toint32(request.querystring["id"]);                 jobreqmodel model = new jobreqmodel();                 jobdescriptions job = model.getjob(id);                  string clientid = context.user.identity.getuserid();                 if (job.postedby == clientid)                 {                     button2.visible = true;                 }                  else                 {                     button2.visible = false;                 }             } 


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -