Trying to add a click event on the peek template of a radtemplate tile as well as a click event to the tile itself. If they click the tile I want it to go to the application that its is attacded to, this works and no problems. We are trying to put a favorites linkbutton in a peek template so that they users can add the tile to there favorites which when they click it I just want the link button to have a commandname and commandargurment that save the id of the tile into a database of favorites for that user. Can this be accomplished ???
<
div
>
<
telerik:RadTileList
runat
=
"server"
ID
=
"RadTileList1"
></
telerik:RadTileList
>
</
div
>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateTileList(0);
PopulateRadMenu();
}
}
protected void PopulateTileList(int tileId)
{
string sqlWhere = string.Empty;
if (tileId == 0)
{
sqlWhere = string.Empty;
}
else
{
sqlWhere = " where intDirectoriteId = " + tileId;
}
sql = "select intAppId, strAppName, strTooltip, strUrl, strNotes, s.strColor from tblApplications a INNER JOIN tblStatus s on s.intStatusID = a.intStatusID " + sqlWhere;
mydatatable = new DataTable();
mydatatable = c.GetReader(sql);
TileGroup tg = new TileGroup();
RadTileList1.Groups.Add(tg);
foreach (DataRow row in mydatatable.Rows)
{
RadContentTemplateTile tile = new RadContentTemplateTile();
tg.Tiles.Add(tile);
LinkButton linkfav = new LinkButton();
linkfav.Attributes.Add("runat", "server");
linkfav.Click += new EventHandler(linkfav_Click);
linkfav.Text = "favorites";
linkfav.Attributes.Add("CommandName", "AddFavorites");
linkfav.Attributes.Add("CommandArgument", row[0].ToString());
tile.ID = row[0].ToString();
tile.Name = row[1].ToString();
tile.ContentContainer.GroupingText = row[1].ToString();
tile.ToolTip = row[2].ToString();
// tile.NavigateUrl = row[3].ToString();
tile.BackColor = System.Drawing.ColorTranslator.FromHtml(row[5].ToString());
//Peektemplate
tile.PeekTemplateSettings.Animation = PeekTemplateAnimation.Slide;
tile.PeekTemplateSettings.HidePeekTemplateOnMouseOut = true;
tile.PeekTemplateSettings.ShowPeekTemplateOnMouseOver = true;
tile.PeekContentContainer.Controls.Add(new LiteralControl(row[4].ToString()));
tile.PeekContentContainer.Controls.Add(linkfav);
tile.PeekTemplateSettings.CloseDelay = 0;
tile.PeekTemplateSettings.ShowInterval = 0;
}
}
private void PopulateRadMenu()
{
sql = "select intDirectoriteID, strDirectorite from tblDirectorite where bitActive = 1";
rdmenu.DataTextField = "strDirectorite";
rdmenu.DataValueField = "intDirectoriteID";
rdmenu.CssClass = "Menuitems";
rdmenu.DataSource = c.GetReader(sql);
rdmenu.DataBind();
}
protected void rdmenu_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
{
switch (e.Item.Value)
{
case "1":
PopulateTileList(1);
break;
case "2":
PopulateTileList(2);
break;
case "3":
PopulateTileList(3);
break;
case "4":
PopulateTileList(4);
break;
case "5":
PopulateTileList(5);
break;
case "6":
PopulateTileList(6);
break;
case "7":
PopulateTileList(7);
break;
}
}
protected void linkfav_Click(object sender, EventArgs e)
{
Response.Write("Try this LinkButton!");
}
}