Click here to Skip to main content
15,914,795 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
<%if(Session["user"]=="admin"){%>
html code
<%}%>
but its not working

please help where i can get wrong

Thanks in advance

Please tell me how to do this in aspx.cs file. I am using datalist and one image(delete) is under the datalist.
i want to show the delete button in side of every comment and show delete button for onle admin user.

please help me
Posted
Updated 14-Jun-11 21:11pm
v2
Comments
Uday P.Singh 15-Jun-11 2:45am    
when you are using ASP.NET why are you doing this in your .aspx file, you should be doing this in your .aspx.cs file.

Why are you putting your code inline ? That makes your code unreadable. Also, if you did this in code behind, you'd be better able to use a debugger to work out what is going wrong. Are you sure it's 'not working', and it's not that your variable is not what you expect ? I'd fire people for writing code like this, any session variables MUST be named from a class of static strings, as the IDE will never check for typos for you. I'd also store values like admin as constants.
 
Share this answer
 
Comments
rahul dev123 15-Jun-11 3:04am    
i used asp image under datalist but it can't access in code behind. How can i do this?
Christian Graus 15-Jun-11 3:42am    
In the item data bound event you can access the controls in the row.
I guess you are confuse with ASP and ASP.NET refer this:

http://www.beansoftware.com/ASP.NET-Tutorials/Classic-ASP-vs-ASP.NET.aspx[^]

to make it clear.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900