Change legend dynamically

3 posts, 1 answers
  1. Cristian
    Cristian  avatar
    46 posts
    Member since:
    May 2011

    Posted 28 Jan 2013 Link to this post

    Hi guys I'm working with RadListView as the main menu of my application, and I'm facing the next problem.
    As you can see, I have two legends(one commented), my question is how can I change the legend dynamically
    based on an integer parameter loaded on page_load event.




    <
    telerik:RadListView  Width="600px"
                         ID="RadListView1" runat="server"
                                ItemPlaceholderID="ProductsHolder"
                                onselectedindexchanged="RadListView1_SelectedIndexChanged"
                                onneeddatasource="RadListView1_NeedDataSource1"  PageSize="2
                                " AllowPaging="true"  DataKeyNames="fiIdReforma" Skin="Black" >
     
                         <LayoutTemplate>
     
                            <table>
                                     <tr> <td>
                               
                             <h3 style="color: #FFFFFF; font-weight: bold;" >DASHBOARDS</h3>
                         
                            </td></tr>
                            <tr>
     
                            <td>
                             <fieldset style="width: 900px;"  >
     
                 <%--       <legend style="color: #FFFFFF">REFORMAS</legend>--%>
                         
                        <legend style="color: #FFFFFF">OBRAS PÚBLICAS</legend>
                        <asp:Panel ID="ProductsHolder" runat="server" />
     
                    </fieldset>
                            </td>
     
                            </table>
     
                            <asp:ImageButton runat="server" ID="btnPrev" CommandName="Page" CommandArgument="Prev"
     
    Text="Anterior"  Visible="<%#Container.CurrentPageIndex > 0 %>"  ImageUrl="~/img/black_left2.png"    />
     
                                                                                                                                                    <asp:ImageButton runat="server" ID="btnNext" CommandName="Page" CommandArgument="Next"
    Text="Siguiente" Visible="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>"  ImageUrl="~/img/black_right2.png" />
                </LayoutTemplate>
     
                <ItemTemplate>
     
                    <div class="reforma">
     <%--  <span>
        <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("fcDescRef") %>'   Font-Bold="true" ClientIDMode="Inherit" ForeColor="White" />
       </span>--%>
       <br />
      <table>
      <tr>
      <td>
      <span>
        <asp:Label ID="Label1" runat="server" Text='<%# Eval("fcDescRef") %>'  Width="200px"  Font-Bold="true"   ClientIDMode="Inherit"  ForeColor="White" style="text-align:justify; vertical-align:middle;" />
       </span>
      </td>
      <td><span>
        <asp:ImageButton ID="SushiImage" runat="server" AlternateText='<%# Eval("fcDescRef") %>' Width="150px" CommandName="Select" ImageUrl='<%# Eval("fcURLimg") %>' />
       </span></td>
      </tr>
      
      </table>
        
     
        
                    <%--<table>
                    <tr>
                    <td>
     
                     <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("fcDescRef") %>'   Font-Bold="true" ClientIDMode="Inherit" ForeColor="White" />
                    </td>
                    </tr>
                    <tr>
                    <td>
     
                    <asp:ImageButton ID="SushiImage" runat="server" AlternateText='<%# Eval("fcDescRef") %>' Width="150px" CommandName="Select" ImageUrl='<%# Eval("fcURLimg") %>' />
     
                    </td>
     
                    <td align="left">
                       <asp:Label ID="Label1" runat="server" Text='<%# Eval("fcObs") %>'  Width="200px"  Font-Bold="true"  ClientIDMode="Inherit"  ForeColor="White" />
                    </td>
                    </tr>
                    </table>--%>
                    </div>
     
                </ItemTemplate>
     
                     </telerik:RadListView>

    Hope Your Help.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Jan 2013 Link to this post

    Hi Cristian

    Try the following code snippet to access the legend in the LayoutTemplate of RadListView.
    aspx:
    <legend id="test" runat="server" style="color: #FFFFFF">OBRAS PÚBLICAS</legend>
    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        if(condition......)
        {
          (RadListView1.FindControl("test") as System.Web.UI.HtmlControls.HtmlGenericControl).Visible = true;
        }
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Cristian
    Cristian  avatar
    46 posts
    Member since:
    May 2011

    Posted 29 Jan 2013 Link to this post

    Thanks Princy.
    That worked perfectly
Back to Top