Trying to retrieve result using linq -
hi have table has column allowstockedit bit
i trying check user has edit access , show edit , delete buttons on radgridview
this code using
protected void accesslevels(object sender, eventargs e) { linqdatacontext dc = new linqdatacontext(); userpermission = dc.userpermissions.where(a => a.id == (int)session["permission"]).singleordefault(); up.allowstockedit = true; } /*show hide buttons */ protected void selectedstockgridview_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { // show edit button when user has right access level if { button btnedit = (button)e.row.findcontrol("showeditbutton"); button btndelete = (button)e.row.findcontrol("showdeletebutton"); btnedit.visible = true; btndelete.visible = true; } } }
i trying check see if user has edit access if show buttons
any help appreciated
something that:
protected bool accesslevels() { linqdatacontext dc = new linqdatacontext(); homecoming dc.userpermissions.where(a => a.id == (int)session["permission"]).singleordefault().allowstockedit; } protected void selectedstockgridview_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { // show edit button when user has right access level if(accesslevels() == true) { button btnedit = (button)e.row.findcontrol("showeditbutton"); button btndelete = (button)e.row.findcontrol("showdeletebutton"); btnedit.visible = true; btndelete.visible = true; } } }
linq
No comments:
Post a Comment