0

im trying to enable a button that is disabled within an itemTemplate, if theres a session then the button will be enabled. however i cannot access the button object in the code-behind file.

HTML CODE
----------

<div id="gal_wrap">
   <asp:ListView ID="ListView1" runat="server" EnableModelValidation="false" OnPagePropertiesChanging="listItems_PagePropertiesChanging">
            <LayoutTemplate>
                    <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
            </LayoutTemplate>
       
            <ItemTemplate> 
              <ul class="thumbnails gallery">
                <li class="gallery">
                       <a style="text-decoration:none;" href="#">
                          <img alt="<%#Eval("gallery_name") %>" style="border:0px;" src="photo_load.aspx?gallery_id=<%#Eval("gallery_id") %>&thumbnail=1" />
                          <span class="below-image"><%#Eval("gallery_name") %></span>
                          <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Visible="false" Text="Button" />                   
                       </a>               
                </li>
              </ul>
            </ItemTemplate>
        </asp:ListView>

CODEBEHIND FILE
---------------

public void Page_Load(object sender, EventArgs e)
        {
            if (Session["x"] != null) //if the user is logged in
            {
                Button1.visable = "true";
            }
        }

Thanks for your help

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by barriegrant1
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.