
try
{
DataSet dsp = new DataSet();
DB.m_da.SetRead("SELECT 'All Providers' AS [Name], '0' AS [ID], null as tree union SELECT [FName] + ' ' + [LName] AS [Name], [ID],0 as [Tree] FROM Provider WHERE [Inactive] = 0 ORDER BY 1", 1);
DB.m_da.Run(ref dsp);
RadTreeView1.DataSource = dsp;
RadTreeView1.DataFieldID =
"ID";
RadTreeView1.DataValueField =
"ID";
RadTreeView1.DataTextField =
"Name";
RadTreeView1.DataFieldParentID =
"Tree";
RadTreeView1.DataBind();
DataSet ds = new DataSet();
DB.m_da.SetRead("Select VID from AppointmentUserSetting where onoff = 1", 1);
DB.m_da.Run(ref ds);
foreach (DataRow row in ds.Tables[0].Rows)
{
// This is where I want to set the node to checked
// node.checked = true;
}
RadTreeView1.ExpandAllNodes();
RadTreeView1.MultipleSelect =
true;
RadTreeView1.CheckBoxes =
true;
Label1.Text =
"";
}
In the webpart I have this control called Link Bubble
<Controls:ContentHelp ID="LinkBubble" runat="server" ContentId="viewuploadfile" TargetControlID="WebPartHelpVerb">
</Controls:ContentHelp>
The above control's implementation is below.
using System;
using System.Text;
using System.Web.UI;
using System.Web;
using System.Xml;
using System.Xml.XPath;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using Telerik.Web.UI;
using AjaxControlToolkit;
using Cts.Bamboo.UI.Controls;
using Cts.Web.Issuer.Utilities;
namespace Cts.Web.Issuer.UI.Controls
{
/// <summary>
///
/// </summary>
public class ContentHelp : CompositeControl
{
#region MODIFIERS
private RadToolTip _radtooltip;
private Cts.Bamboo.UI.Controls.ContentPanel _content;
private string _controlPositioningStyleId = string.Empty;
internal Parameter countryCode = new Parameter("country-code", TypeCode.String, (string)HttpContext.Current.Profile[ProfileVars.IssuerCountryCode]);
#endregion
/// <summary>
///
/// </summary>
public ContentHelp()
{ }
#region PROPERTIES
/// <summary>
///
/// </summary>
public string ContentId
{
get { base.EnsureChildControls(); return _content.SelectParameters[0].DefaultValue; }
set { base.EnsureChildControls(); _content.SelectParameters[0].DefaultValue = value;}
}
/// <summary>
///
/// </summary>
public string TargetControlID
{
get { base.EnsureChildControls(); return _radtooltip.TargetControlID; }
set { base.EnsureChildControls(); _radtooltip.TargetControlID = value; }
}
/// <summary>
///
/// </summary>
public string ControlPositioningStyleId
{
get { base.EnsureChildControls(); return _controlPositioningStyleId; }
set { base.EnsureChildControls(); _controlPositioningStyleId = value; }
}
/// <summary>
///
/// </summary>
public RadToolTip Extender
{
get { base.EnsureChildControls(); return _radtooltip; }
}
#endregion
#region DESIGNER CREATION
/// <summary>
///
/// </summary>
protected override void CreateChildControls()
{
this.Controls.Clear();
this._content = new Cts.Bamboo.UI.Controls.ContentPanel();
this._content.ItemTemplate = new HelpTemplate(this);
this._content.Source = "webpart-help";
{
QueryStringParameter helpIdparam = new QueryStringParameter("help-id", "help");
this._content.SelectParameters.Add(helpIdparam);
this._content.SelectParameters.Add(countryCode);
}
_radtooltip = new RadToolTip();
_radtooltip.ID = "popup";
_radtooltip.ShowEvent = ToolTipShowEvent.OnClick;
_radtooltip.ShowDelay = 0;
_radtooltip.ManualClose = true;
_radtooltip.Position = ToolTipPosition.MiddleRight;
_radtooltip.RelativeTo = ToolTipRelativeDisplay.Element;
_radtooltip.TargetControlID = this.TargetControlID;
_radtooltip.Controls.Add(this._content);
_radtooltip.Animation = ToolTipAnimation.FlyIn;
this.Controls.Add(this._radtooltip);
this.ChildControlsCreated = true;
}
#endregion
#region PRE-RENDER
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (((HelpTemplate)this._content.ItemTemplate).Nav.ToString() != "")
{
((System.Web.UI.WebControls.WebParts.WebPart)Parent).HelpUrl = ((HelpTemplate)this._content.ItemTemplate).Nav.ToString();
}
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
protected override void Render(HtmlTextWriter writer)
{
if (string.IsNullOrEmpty(ControlPositioningStyleId))
{
ControlPositioningStyleId = "bubble-wrapper";
}
writer.AddAttribute(HtmlTextWriterAttribute.Class, ControlPositioningStyleId);
writer.RenderBeginTag(HtmlTextWriterTag.Div);
base.RenderChildren(writer);
writer.RenderEndTag();
}
#region INNER CLASS HELP TEMPLATE
private class HelpTemplate : ITemplate
{
#region modifiers and properties
string morehelptext = string.Empty;
string title = string.Empty;
string shortdescription = string.Empty;
string navigationalurl = string.Empty;
string longdescription = string.Empty;
string longdescriptionurl = string.Empty;
string navurl = string.Empty;
private ContentHelp _help;
public HelpTemplate(ContentHelp help)
{
this._help = help;
}
public ContentHelp HelpContent
{
get { return _help; }
set { _help = value; }
}
public string Nav
{
get { return navurl; }
set { navurl = value; }
}
#endregion
void ITemplate.InstantiateIn(Control container)
{
container.DataBinding += delegate
{
//container that holds the text
object dataItem = ((IDataItemContainer)container).DataItem;
#region web content values
//'More Help' text
morehelptext = (string)HttpContext.GetGlobalResourceObject("Issuer/Help", "/Issuer/Help/Url");
XPathNavigator nav = ((IXPathNavigable)dataItem).CreateNavigator();
//title
if (nav.Select("title").Count > 0) //if "title" node exist
{
title = (String)nav.SelectSingleNode("title").ToString();
}
//url
if (nav.Select("url").Count > 0) //if url node exist
{
navigationalurl = nav.SelectSingleNode("url").Value.Trim();
}
//short description
if (nav.Select("short-description").Count > 0) //if "short-description" node exist
{
shortdescription = nav.SelectSingleNode("short-description").Value.Trim();
}
//long description
if (nav.Select("long-description").Count > 0) //if "long-description" node exist
{
longdescription = nav.SelectSingleNode("long-description").Value.Trim();
}
// long dscriontion utl
if (ConfigurationSettings.AppSettings["HelpLongDescURL"] != null)
{
longdescriptionurl = ConfigurationSettings.AppSettings["HelpLongDescURL"].ToString();
}
#endregion
#region Test only
//@@@@@@@@@@@TEST ONLY........................
//longdescription = "";
//shortdescription = "";
//navigationalurl = "http://computershare.com/";
//title = "";
//navigationalurl = "";
//@@@@@@@@@@@TEST ONLY........................
//string val = (string)System.Web.HttpContext.Current.Profile.GetPropertyValue("CountryCode");
#endregion
#region main content
Literal bubbleMainLtrl = new Literal();
bubbleMainLtrl.Text = "<h5>" + this.title + "</h5>" + this.shortdescription;
container.Controls.Add(bubbleMainLtrl);
HtmlGenericControl utltext = new HtmlGenericControl();
LiteralControl urrLtrl = new LiteralControl("</div><div class=\"bubblelink\">");
#endregion
#region logic
//applying the logic
if (navigationalurl != string.Empty) //if there is a url : display url
{
if (this.shortdescription != string.Empty || this.title != string.Empty)
{
Nav = navigationalurl;
urrLtrl.Text = "<a href='" + navigationalurl + "' originalAttribute="href" originalPath="" + navigationalurl + "" originalAttribute="href" originalPath="" + navigationalurl + "" >" + morehelptext + "</a>";
utltext.Controls.Add(urrLtrl);
container.Controls.Add(utltext);
}
else
{
Nav = navigationalurl;
this.HelpContent._radtooltip.Enabled = false;
}
}
else if (longdescription != string.Empty)
{
//short desc
if (this.shortdescription != string.Empty)
{
if (this.HelpContent.ContentId != null)
{
//urrLtrl.Text = "<a href='" + longdescriptionurl + this.HelpContent.ContentId + "' originalAttribute="href" originalPath="" + longdescriptionurl + this.HelpContent.ContentId + "" originalAttribute="href" originalPath="" + longdescriptionurl + this.HelpContent.ContentId + "" originalAttribute="href" originalPath="" + longdescriptionurl + this.HelpContent.ContentId + "" originalAttribute="href" originalPath="" + longdescriptionurl + this.HelpContent.ContentId + "" >" + morehelptext + "</a>";
urrLtrl.Text = "<a href='" + longdescriptionurl + this.HelpContent.ContentId + "' originalAttribute="href" originalPath="" + longdescriptionurl + this.HelpContent.ContentId + "" originalAttribute="href" originalPath="" + longdescriptionurl + this.HelpContent.ContentId + "" target='_blank' >" + morehelptext + "</a>";
utltext.Controls.Add(urrLtrl);
container.Controls.Add(utltext);
Nav = longdescriptionurl + this.HelpContent.ContentId;
}
else
{
//disable the bubble
this.HelpContent._radtooltip.Enabled = false;
}
}
else //no short description only long description
{
if (this.HelpContent.ContentId != null)
{
//System.Web.HttpContext.Current.Response.Redirect(longdescriptionurl + this.HelpContent.ContentId, false);
Nav = longdescriptionurl + this.HelpContent.ContentId;
this.HelpContent._radtooltip.Enabled = false;
}
}
}
else //if no long desc and no url
{
if (shortdescription == string.Empty) //no short desc
{
this.HelpContent._radtooltip.Enabled = false;
}
else
{ /*dislpay the short description only*/ }
}
#endregion
this._help._radtooltip.Title = this.title;
this._help._radtooltip.Text = this.shortdescription + "<br />" + urrLtrl.Text;
};
}
}
#endregion
}
}
<
Controls:ContentHelp ID="LinkBubble1" runat="server" ContentId="viewuploadfile1" TargetControlID="WebPartHelpVerb">
</
Controls:ContentHelp>
<Controls:ContentHelp ID="LinkBubble2" runat="server" ContentId="viewuploadfile2" TargetControlID="WebPartHelpVerb">
</
Controls:ContentHelp>
only one of them is work. Please help
Thanks
Raj
| <%@ Page Language="C#" %> | |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| <script runat="server"> | |
| </script> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head runat="server"> | |
| <title></title> | |
| </head> | |
| <body> | |
| <form id="form1" runat="server"> | |
| <div> | |
| <telerik:RadScriptManager | |
| id="RSM" | |
| runat="server" | |
| > | |
| </telerik:RadScriptManager> | |
| <telerik:RadMenu | |
| id="rmType" | |
| runat="server" | |
| Flow="Horizontal" | |
| > | |
| <Items> | |
| <telerik:RadMenuItem | |
| Text="Spending" | |
| > | |
| <Items> | |
| <telerik:RadMenuItem Text="Spending" /> | |
| <telerik:RadMenuItem Text="Income" /> | |
| </Items> | |
| </telerik:RadMenuItem> | |
| </Items> | |
| </telerik:RadMenu> | |
| <telerik:RadNumericTextBox | |
| id="rtnbAmount" | |
| runat="server" | |
| Value="12.2" | |
| > | |
| </telerik:RadNumericTextBox> | |
| <telerik:RadMenu | |
| id="rmCurrency" | |
| runat="server" | |
| Flow="Horizontal" | |
| > | |
| <Items> | |
| <telerik:RadMenuItem | |
| Text="€" | |
| > | |
| <Items> | |
| <telerik:RadMenuItem Text="€ - EUR" Value="1" /> | |
| <telerik:RadMenuItem Text="$ - USD" Value="2" /> | |
| <telerik:RadMenuItem Text="Other"> | |
| <Items> | |
| <telerik:RadMenuItem Text="£ - GBP" Value="5" /> | |
| <telerik:RadMenuItem Text="Y - YEN" Value="6" /> | |
| </Items> | |
| </telerik:RadMenuItem> | |
| </Items> | |
| </telerik:RadMenuItem> | |
| </Items> | |
| </telerik:RadMenu> | |
| </div> | |
| </form> | |
| </body> | |
| </html> | |