p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

aspdotnet_website_programming thread: Re: Hide columns on default page when not logged in as Admin


Message #1 by "Claude Wynne" <claudew@i...> on Sun, 26 Jan 2003 16:34:53
I'm wondering if anyone has found a solution to this issue.  I'm having 
the same problem on my site.  For some reason on the default page, the 
visible setting won't work when set to a property or function result such 
as Visible = '<%# CanAdministerCategories%>' or Visible ='<%# 
GetVisibleSetting() %>'.  It works fine on other pages but for some 
reason it always sets visible to true (even when the variable or function 
result is false) on the default.aspx page. Any ideas?

Claude


> I would like to hide the empty columns that house the graphics when not 
l> ogged in as an Administrator. 

> Here is the code:

> 
I>  tried to make Visible='<%# CanAdministerCategories%>' in the 
I> temTemplate but it blows. I can hard code it and it works. Any try 
this?

> 

> 
<> asp:DataGrid runat="server" AutoGenerateColumns="False" 
	> 							
	> CssClass="Forums_General" 
	> 							
	> ItemStyle-CssClass="Forums_Item" 
	> 							
	> AlternatingItemStyle-CssClass="Forums_AlternatingItem" 
	> 							
	> DataKeyField="ForumID" 
	> 							
	> DataSource='<%# GetForumsSource(int.Parse(DataBinder.Eval
(> Container.DataItem, "CategoryID").ToString())) %>' 
	> 							
	> OnEditCommand="ForumsGrid_Edit" 
	> 							
	> ShowHeader="False" 
	> 							
	> Width="100%">
	> 							
	> <Columns>
	> 								
	> <asp:TemplateColumn ItemStyle-Wrap="True">
	> 								
	> 	<ItemTemplate>
	> 								
	> 		<asp:ImageButton Runat="server" 
CommandName="Edit" 
	> 								
	> 			Visible='<%# CanAdministerCategories %>' 
	> 								
	> 			ImageUrl="./Images/Edit.gif"
	> 								
	> 			AlternateText="Edit this forum" 
B> orderWidth="0"/>
	> 								
	> 	</ItemTemplate>
	> 								
	> </asp:TemplateColumn>
	> 								
	> <asp:TemplateColumn ItemStyle-Wrap="True">
	> 								
	> 	<ItemTemplate>
	> 								
	> 		<asp:HyperLink Runat="server" NavigateUrl='<%
#>  "javascript:DeleteForum(" + DataBinder.Eval
(> Container.DataItem, "ForumID") + ")" %>'
	> 								
	> 			Visible='<%# CanAdministerCategories %>'
	> 								
	> 			Text="<img border=0 Alt='Delete this 
f> orum' src=./Images/Delete.gif>" />
	> 						
	> </ItemTemplate>
	> 								
	> </asp:TemplateColumn>

> Todd

  Return to Index