I have a div which contains a button .I am initially setting div display:none & depending upon the user rights i am showing it to user using javascript.
<div id="mydiv" style="display:none">
<asp:Button id="btn" runat="server"/>
</div>
PageMethods.GetRights(onsuccess);
function onsuccess(result){
if(result.isaccessible)
{
$("#mydiv").show();
}
}
Is Showing,Hiding at client risky. I dont want to use updatepanel if it is risky what is an alternative to this i have?
Anyone could view this div if they changed the display to “block” with an html inspector.
If you are wanting this information to remain private I would suggest a different way of doing this.
The first, and the best way, is to skip the JavaScript and use the server to check the user’s rights and display the div.
The second way is to make an Ajax call. If you would like this to work with JavaScript than I would suggest using an ajax call to the server in order to get the information you want. Let the server check the user rights and return the div on success. Then simply replace the div’s html with that returned from the server. Something like this might work: