Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

CollapsiblePanelExtender - need to hide a control in the panel

$
0
0

I have a simple example webpage to illlustrate a problem I have. The page has a collapsiblePanelExtender (emailPanel) that has a label in it "EmailLabel". When the "emailPanel" is shown I want to check and see if the value in "emailLabel" contains "hotmail.com". If it does I want to hide "EmailLabel". Or is my train of thought completely wrong, should this be handled another way??

How do I do this? Please provide code as I suspect this will require Javascript and I no nothing about it. I would prefer a method that uses 100% codebehind in the .vb file.

Thanks

Here is the page:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to ASP.NET!
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </h2>
    <br />
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
        <ItemTemplate>
            
                <tr>
                    <td>
                        <asp:Label ID="UserIdLabel" runat="server" Text='<%# Eval("UserId") %>' />
                    </td>
                    <td>
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                    </td>
                    <td>
                        <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
                        <asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" TargetControlID="emailPanel"
                            AutoCollapse="False" Collapsed="True" CollapsedText="show" ExpandedText="hide"
                            Enabled="True" CollapseControlID="LinkButton1" ExpandControlID="LinkButton1"
                            ExpandedSize="30" CollapsedSize="0" SuppressPostBack="True" TextLabelID="LinkButton1">
                        </asp:CollapsiblePanelExtender>
                        <asp:Panel ID="emailPanel" runat="server">
                            <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                        </asp:Panel>
                    </td>
            </tr>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;
                            border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;
                            font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr runat="server" style="background-color: #DCDCDC; color: #000000;">
                                <th runat="server">
                                    UserId
                                </th>
                                <th runat="server">
                                    Username
                                </th>
                                <th runat="server">
                                    Email
                                </th>
                            </tr>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [UserId], [Email], [UserName] FROM [vw_aspnet_MembershipUsers]">
    </asp:SqlDataSource>
</asp:Content>


Viewing all articles
Browse latest Browse all 5678

Trending Articles