Wrox Home  
Search P2P Archive for: Go

  Return to Index  

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


Message #1 by "Todd Mueller" <lenny_92675@y...> on Wed, 13 Nov 2002 21:58:36
I would like to hide the empty columns that house the graphics when not 
logged in as an Administrator. 

Here is the code:


I tried to make Visible='<%# CanAdministerCategories%>' in the 
ItemTemplate 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" 
BorderWidth="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 
forum' src=./Images/Delete.gif>" />
							
	</ItemTemplate>
									
	</asp:TemplateColumn>

Todd
Message #2 by "Todd Mueller" <lenny_92675@y...> on Thu, 14 Nov 2002 15:20:36
anyone try this?

Ive posted on other message boards and have had no luck.

Todd

  Return to Index