I'm having a problem. I want to put info from a database in the title of a dock, but I can't do that.
I tried the following example, but it gaves a parse error, because it's not possible:
<
telerik:RadDock ID="RadDock2" runat="server" Title="Conteudos da Tag '<%# Eval("Nome")%>'" EnableDrag="false">
...
</telerik:RadDock>
How can I solve this problem?
3 Answers, 1 is accepted
I think what you are trying to do will only work in a Databound control such as a repeater.
Can you post the full code of the page and I can show you how to set the title dynamically in the code behind.
Thanks,
Ronan
<%
@ Control Language="C#" AutoEventWireup="true" CodeFile="conteudosTag.ascx.cs" Inherits="conteudosTag" %>
<%
@ Register Assembly="RadDock.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%
@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<
asp:SqlDataSource ID="GET_CONTEUDOS_TAG" runat="server" ConnectionString="<%$ ConnectionStrings:lms_bibliotecaConnectionString1 %>"
SelectCommand="SELECT * FROM [NL_LMS_BIB_conteudos] INNER JOIN NL_LMS_BIB_temas ON
NL_LMS_BIB_conteudos.IDTema = NL_LMS_BIB_temas.IDTema INNER JOIN NL_LMS_BIB_tipos ON NL_LMS_BIB_conteudos.IDTipo = NL_LMS_BIB_tipos.IDTipo INNER JOIN NL_LMS_BIB_users ON NL_LMS_BIB_conteudos.IDUserAutor = NL_LMS_BIB_users.IDUser
WHERE NL_LMS_BIB_tags.IDTag = @tag">
<SelectParameters>
<asp:ControlParameter ControlID="Literal3" Name="tag" PropertyName="Text" Type="String" />
</SelectParameters>
</
asp:SqlDataSource>
<asp:Literal ID="Literal3" runat="server" Visible="false"></asp:Literal>
<telerik:RadDockZone ID="RadDockZone2" runat="server" Width="70%" >
<
telerik:RadDock ID="RadDock2" runat="server" Title="Contedos da Tag x" EnableDrag="false">
<
ContentTemplate>
<telerik:RadGrid ID="ConteudosTag" runat="server" OnItemDataBound="ConteudosTag_ItemDataBound" AllowPaging="True" AllowSorting="True" DataSourceID="GET_CONTEUDOS_TAG" GridLines="None" AutoGenerateColumns="false" PageSize="10" ClientSettings-EnableRowHoverStyle="True">
<MasterTableView CellSpacing="-1" DataSourceID="GET_CONTEUDOS_TAG">
<PagerStyle Mode="NextPrevAndNumeric" PagerTextFormat="{4} Pgina {0} de {1}, itens {2} a {3} de {5}" />
<Columns>
<
telerik:GridHyperLinkColumn
DataNavigateUrlFormatString="/lms_bd/FichaConteudo.aspx?conteudo={0}" DataTextField="Titulo" Target="_self" DataNavigateUrlFields="IDConteudo" UniqueName="Titulo" HeaderText="Ttulo" SortExpression="Titulo" />
<
telerik:GridBoundColumn
DataField="Nome" DataType="System.String" HeaderText="Autor" SortExpression="Nome" UniqueName="Nome"></telerik:GridBoundColumn>
<
telerik:GridHyperLinkColumn
DataNavigateUrlFormatString="/lms_bd/conteudosTema.aspx?tema={0}" DataTextField="Tema" Target="_self" DataNavigateUrlFields="IDTema" UniqueName="Tema" HeaderText="Tema" SortExpression="Tema" />
<
telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/imagens/page_white_put.png" ItemStyle-HorizontalAlign="Center" HeaderText="Descarregar"></telerik:GridButtonColumn>
</
Columns>
</
MasterTableView>
</telerik:RadGrid>
</ContentTemplate>
</telerik:RadDock>
</telerik:RadDockZone>
In the .cs file I have this code, but perhaps this is not very important:
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
public
partial class conteudosTag : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string thisTag = Request.QueryString["tag"].ToString();
Literal3.Text = thisTag;
}
protected void ConteudosTag_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridPagerItem)
{
Label lblPageSize = (Label)e.Item.FindControl("ChangePageSizeLabel");
lblPageSize.Text =
"Itens por pgina:";
}
}
}
Hope you can solve my problem!
If you want to use a custom title for the RadDock, the TitlebarTemplate should be used. It can be specified either dynamically by setting the TitlebarTemplate property to an instance of a class that implements ITemplate, or at design time. I have implemented a sample project (it is attached to the thread) that specifies the TitlebarTemplate at design time and updates its content dynamically by retrieving information from a database.
If you have any further questions, please do not hesitate to contact us.
All the best,
Pero
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.