How to hide button according to user login in asp.net -


i have sort of problem hide button after user login. below snap/image explains problem:

check image enter image description here

in above image, see both user i.e "wajid" , "aamir" have visible of edit button.

now want if "wajid" login edit button show wajid not "aamir".

during login session is:

session["username"] 

i tried this, not work:

string sessionname=session["username"].tostring(); if (sessionname == firstname) {    (int = 0; <dealpointscommentlist1.items.count; i++)    {         edit =(linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn");                                 edit.visible =true;    } } else {    (int = 0; < dealpointscommentlist1.items.count; i++)    {          edit =(linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn");    }                            edit.visible = false;  } 

kindly reply me , provide sort of example.

try code.

  string sessionname=session["username"].tostring(); if (sessionname == firstname) {    (int = 0; <dealpointscommentlist1.items.count; i++)    {         labelname = (label)dealpointscommentlist1.items[i].findcontrol("lblfirstname");         if(labelname.text == sessionname)         {            edit = (linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn");                                 edit.visible =true;         }         else         {           edit =(linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn");                                   edit.visible =false;        }    } } else {    (int = 0; < dealpointscommentlist1.items.count; i++)    {          edit =(linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn");    }                            edit.visible = false;  } 

hope helps.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -