private
void
LoadRootNodes(RadTreeView treeView)
{
const
string
sql =
"Select Name, ItemID from TNodes where ParentID IS NULL "
;
SqlConnection dbCon =
new
SqlConnection(
"Data Source=localhost;Initial Catalog=Telerik;user id=sa; password=knowdev"
);
SqlDataAdapter adapter =
new
SqlDataAdapter(sql, dbCon);
DataTable dataTable =
new
DataTable();
adapter.Fill(dataTable);
RadTreeNode node =
new
RadTreeNode();
foreach
(DataRow row
in
dataTable.Rows)
{
//RadTreeViewContextMenu contextmenu1 = new RadTreeViewContextMenu();
//contextmenu1.ID = row["Name"].ToString();
//RadTreeView2.ContextMenus.Add(contextmenu1);
//contextmenu1.Items.Add(new RadMenuItem(row["Name"].ToString()));
node.Text = row[
"Name"
].ToString();
node.Value = row[
"ItemID"
].ToString();
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
RadTreeView2.Nodes.Add(node);
}
foreach
(RadTreeNode nd
in
RadTreeView2.GetAllNodes())
{
RadTreeViewContextMenu contextmenu2 =
new
RadTreeViewContextMenu();
contextmenu2.ID = nd.Text;
RadTreeView2.ContextMenus.Add(contextmenu2);
nd.ContextMenuID = contextmenu2.ID;
contextmenu2.Items.Add(
new
RadMenuItem(nd.Text));
}
}
//ON Expand
protected
void
RadTreeView2_NodeExpand(
object
sender, RadTreeNodeEventArgs e)
{
const
string
sql =
@"
SELECT TNodes.ItemID AS NodeId, TNodes.Name AS NodeText, COUNT(Children.ItemID) AS ChildCount
FROM TNodes LEFT JOIN TNodes As Children
ON TNodes.ItemID = Children.ParentId
WHERE TNodes.ParentId = @parentId
GROUP BY TNodes.ItemID, TNodes.Name
";
SqlConnection dbCon =
new
SqlConnection(
"Data Source=localhost;Initial Catalog=Telerik;user id=sa; password=knowdev"
);
SqlDataAdapter adapter =
new
SqlDataAdapter(sql, dbCon);
adapter.SelectCommand.Parameters.AddWithValue(
"parentId"
, e.Node.Value);
DataTable dataTable =
new
DataTable();
adapter.Fill(dataTable);
foreach
(DataRow row
in
dataTable.Rows)
{
RadTreeNode node =
new
RadTreeNode();
node.Text = row[
"NodeText"
].ToString();
node.Value = row[
"NodeId"
].ToString();
if
(Convert.ToInt32(row[
"ChildCount"
]) > 0)
{
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
}
if
(!(e.Node.TreeView.ContextMenus[0].ID ==
"test"
))
{
e.Node.TreeView.ContextMenus[0].Items[0].Text =
"test"
;
e.Node.TreeView.ContextMenus[0].Items[0].Value =
"1"
;
}
e.Node.Nodes.Add(node);
}
e.Node.Expanded =
true
;
//e.Node.ExpandMode = TreeNodeExpandMode.ClientSide;
foreach
(RadTreeNode nd
in
e.Node.GetAllNodes())
{
RadTreeViewContextMenu contextmenu =
new
RadTreeViewContextMenu();
contextmenu.ID = nd.Text;
RadTreeView2.ContextMenus.Add(contextmenu);
nd.ContextMenuID = contextmenu.ID;
contextmenu.Items.Add(
new
RadMenuItem(nd.Text));
}
}
if(!IsPostBack)
LoadRootNodes(RadTreeView2);
LoadRootNodes() functioned is called at that time context menu show properly. but when I expand the node it does not show.
Code is mentioned above. Please suggest.
Thanks,
Guys,
I’m experimenting with rotator control, new CoverFlow functionality to be exact. I like it but there is one thing that I cannot figure out how to do. Basically I’m trying to make images progressively smaller. So selected images is the biggest, then the image on the right and on the left a bit smaller, then images behind those are smaller…. Is possible to something like this? I see that you have a transformation minScale but it’s static and only applied to a first level. I guess I’m asking if its possible to do the same thing that you do with carousel (making images progressively smaller) with CoverFlow
Thank you
Orest
C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q3
2010\Bin40\Telerik.Web.UI.dll
C:\Program Files (x86)\Telerik\RadControls for ASP.NET AJAX Q3
2010\Bin40\Telerik.Web.UI.dll
I have a website project and want to put a hyperlink on the web page. To do this, I created a custom namespace in Default.aspx.cs. I got errors when building the solution. Is
the namespace code in the wrong place ? or do I need to create an assembly for it to fix the errors ? What am I missing ?
Here is the namespace, other details and errors:
In Default.aspx page I put
<%@ Register TagPrefix="study1wc" Namespace="study1.webcontrols" %> <study1wc:popupWindow NavigateUrl="http://www.google.com" runat="server" ID="test">testing</study1wc:popupWindow>
In Default.aspx.cs page I put
namespace study1.webcontrols { public class popupWindow : HyperLink {etc... }
protected override void Render(HtmlTextWriter writer)
{
HyperLink link = this;
writer.Write(
"<a");
if (!string.IsNullOrEmpty(link.NavigateUrl))
writer.WriteAttribute(
"href", "#");
if (!string.IsNullOrEmpty(link.CssClass))
writer.WriteAttribute(
"class", link.CssClass);
if (_intWindowHeight <= 0 || _intWindowWidth <= 0)
{writer.WriteAttribute(
"onclick", "window.open('" + link.NavigateUrl + "');return false;");}
else
{writer.WriteAttribute(
"onclick", "window.open('" + link.NavigateUrl + "','"+ _strPopupTitle +"','width="+ _intWindowWidth +",height="+ _intWindowWidth +"');return false;");}
foreach (string key in link.Attributes.Keys)
{writer.WriteAttribute(key, link.Attributes[key]);}
writer.Write(
">");
RenderContents(writer);
writer.Write(
"</a>");
}
protected override void RenderContents(HtmlTextWriter output)
{output.Write(Text);}
}
}
[Note: there is a RadGrid and RadComboBoxes defined after the custom namespace]Errors when I Build Solution:
Default.aspx - Warning Element 'popupWindow' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
Default.aspx - Error Unknown server tag 'study1:popupWindow'.
Ofcourse in my Images folder both FranceData.png and GermanyData.png exists. Below is my Gridview declarations.
Thanks
GC_0620
<
asp:GridView
ID
=
"GridView1"
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
CellPadding
=
"0"
GridLines
=
"None"
CellSpacing
=
"0"
runat
=
"server"
CssClass
=
"RadGridLike"
>
<
HeaderStyle
CssClass
=
"GridHeader"
></
HeaderStyle
>
<
Columns
>
<
asp:BoundField
DataField
=
"CompanyName"
HeaderText
=
"Company Name"
/>
<
asp:BoundField
DataField
=
"Country"
HeaderText
=
"Country"
/>
<
asp:TemplateField
HeaderText
=
"Details"
>
<
ItemTemplate
>
<
a
href
=
"#"
onclick
=
"openRadWindow('<%#DataBinder.Eval(Container.DataItem,"
CustomerID")%>'); return false;">
<
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/FranceData.png"
/></
a
>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 10 [CompanyName], [CustomerID], [ContactName], [Country] FROM [Customers]">
</
asp:SqlDataSource
>
<
telerik:RadChart
ID
=
"chr_kgs"
runat
=
"server"
Skin
=
"DeepBlue"
Visible
=
"true"
ChartImageFormat
=
"Jpeg"
>
<
PlotArea
Appearance-FillStyle-MainColor
=
"#003366"
XAxis-Appearance-LabelAppearance-FillStyle-FillSettings-ImageDrawMode
=
"Align"
Appearance-FillStyle-FillType
=
"Gradient"
Appearance-FillStyle-FillSettings-GradientMode
=
"Vertical"
Appearance-FillStyle-FillSettings-HatchStyle
=
"BackwardDiagonal"
Appearance-FillStyle-SecondColor
=
"#003366"
YAxis2-Appearance-MinorGridLines-Visible
=
"True"
YAxis2-Appearance-MinorTick-Visible
=
"False"
YAxis-Appearance-MinorGridLines-Visible
=
"False"
YAxis-Appearance-MinorGridLines-HideWithAxis
=
"True"
YAxis-Appearance-MajorTick-Width
=
"1"
XAxis-Appearance-MajorGridLines-HideWithAxis
=
"True"
XAxis-Appearance-MajorGridLines-Visible
=
"False"
XAxis-Appearance-MinorGridLines-Visible
=
"False"
XAxis-Appearance-MajorGridLines-Width
=
"0"
XAxis-Appearance-MajorTick-Width
=
"1"
XAxis-Appearance-MajorGridLines-Color
=
"#003366"
XAxis-Appearance-MajorTick-Color
=
"#003366"
XAxis-Appearance-MinorGridLines-Color
=
"#003366"
XAxis-Appearance-MinorTick-Color
=
"#003366"
YAxis-Appearance-MinorGridLines-Color
=
"#003366"
>
</
PlotArea
>
<
Appearance
BarWidthPercent
=
"10"
Dimensions-AutoSize
=
false
></
Appearance
>
</
telerik:RadChart
>