protected
void
RTVIndagini_NodeExpand(
object
sender, RadTreeNodeEventArgs e)
{
//if (e.Node.Nodes.Count != 0) return;
switch
(e.Node.Category)
{
case
"trimestre"
:
{
decimal
anno =
int
.Parse(e.Node.ParentNode.Value);
decimal
trimestre =
int
.Parse(e.Node.Value);
IndagineModel im =
new
IndagineModel();
IDictionary<
decimal
, String> enti = im.getEnti(anno, trimestre);
foreach
(
decimal
key
in
enti.Keys)
{
RadTreeNode nodoEnte =
new
RadTreeNode(enti[key], key.ToString());
nodoEnte.Category =
"ente"
;
nodoEnte.ExpandMode = TreeNodeExpandMode.ServerSide;
e.Node.Nodes.Add(nodoEnte);
}
break
;
}
case
"ente"
:
{
Decimal ente = Decimal.Parse(e.Node.Value);
RadTreeNode trimestre = e.Node.ParentNode;
Decimal trimestreValue = Decimal.Parse(trimestre.Value);
Decimal anno = Decimal.Parse(trimestre.ParentNode.Value);
IndagineModel im =
new
IndagineModel();
IDictionary<String,String> codiciReclamo = im.getCodiciReclamo(anno, trimestreValue, ente);
foreach
(String key
in
codiciReclamo.Keys )
{
RadTreeNode nodoCodiceReclamo =
new
RadTreeNode(
String.Format(
"{0} - {1}"
, key, codiciReclamo[key]), key);
nodoCodiceReclamo.Category =
"codicereclamo"
;
nodoCodiceReclamo.ExpandMode = TreeNodeExpandMode.ServerSide;
e.Node.Nodes.Add(nodoCodiceReclamo);
}
break
;
}
case
"codicereclamo"
:
{
DatiPratiche dto =
new
DatiPratiche();
dto.reclamo = e.Node.Value;
RadTreeNode ente = e.Node.ParentNode;
dto.ente =
decimal
.Parse(e.Node.ParentNode.Value);
RadTreeNode trimestre = ente.ParentNode;
dto.trimestre =
decimal
.Parse(trimestre.Value);
dto.anno =
decimal
.Parse(trimestre.ParentNode.Value);
//TestNodeTempateOnDemand tst = new TestNodeTempateOnDemand();
customControls_Indagine_NodeTemplate tst =
new
customControls_Indagine_NodeTemplate();
RadTreeNode temp =
new
RadTreeNode();
tst.InstantiateIn(temp);
e.Node.Nodes.Add(temp);
RTVIndagini.DataBind();
}
break
;
}
//e.Node.Expanded = true;
e.Node.ExpandMode = TreeNodeExpandMode.ClientSide;
//RTVIndagini.DataBind();
}
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="NodeTemplate.ascx.cs" Inherits="customControls_Indagine_NodeTemplate" %>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"ObjectDataSource1"
GridLines
=
"None"
Skin
=
"Web20"
onitemdatabound
=
"RadGrid1_ItemDataBound"
AllowPaging
=
"True"
AllowSorting
=
"True"
>
<
MasterTableView
DataSourceID
=
"ObjectDataSource1"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"C_COD_REC"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"C_COD_REC"
HeaderText
=
"C_COD_REC"
ReadOnly
=
"True"
SortExpression
=
"C_COD_REC"
UniqueName
=
"C_COD_REC"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"C_MAC_ARE"
HeaderText
=
"C_MAC_ARE"
SortExpression
=
"C_MAC_ARE"
UniqueName
=
"C_MAC_ARE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"C_ARE"
HeaderText
=
"C_ARE"
SortExpression
=
"C_ARE"
UniqueName
=
"C_ARE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"C_DET"
HeaderText
=
"C_DET"
SortExpression
=
"C_DET"
UniqueName
=
"C_DET"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"T_RIF_TAB"
DataType
=
"System.Decimal"
HeaderText
=
"T_RIF_TAB"
SortExpression
=
"T_RIF_TAB"
UniqueName
=
"T_RIF_TAB"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"C_MOD"
HeaderText
=
"C_MOD"
SortExpression
=
"C_MOD"
UniqueName
=
"C_MOD"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSource1"
runat
=
"server"
DeleteMethod
=
"delete"
InsertMethod
=
"insert"
OldValuesParameterFormatString
=
"original_{0}"
SelectMethod
=
"getDatiCodice"
TypeName
=
"CodiceReclamo"
UpdateMethod
=
"update"
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"Original_C_COD_REC"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Original_C_MAC_ARE"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Original_C_ARE"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Original_C_DET"
Type
=
"String"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"T_RIF_TAB"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"Original_C_COD_REC"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Original_C_MAC_ARE"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Original_C_ARE"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"C_MOD"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Original_C_DET"
Type
=
"String"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"C_COD_REC"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"C_MAC_ARE"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"C_ARE"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"C_DET"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"T_RIF_TAB"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"C_MOD"
Type
=
"String"
/>
</
InsertParameters
>
</
asp:ObjectDataSource
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
public
partial
class
customControls_Indagine_NodeTemplate : System.Web.UI.UserControl,ITemplate
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
#region ITemplate Members
public
void
InstantiateIn(Control container)
{
RadGrid RadGrid1 =
new
RadGrid();
RadGrid1.DataBinding +=
new
EventHandler(RadGrid_DataBinding);
container.Controls.Add(RadGrid1);
}
void
RadGrid_DataBinding(
object
sender, EventArgs e)
{
// I must add the following line of code to see the grid displayed
//inside the tree node, but i don't have any paging, sorting ...
//RadGrid target = (RadGrid)sender;
//RadTreeNode node = (RadTreeNode)target.BindingContainer;
//EnteModello em = new EnteModello();
//target.DataSource = em.getModelliPerEnte();
}
#endregion
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
}
}
<
telerik:RadMenu ID="FarsiMenu" Runat="server" DataFieldParentID="MenuParentID" dir="rtl"
DataNavigateUrlField="AdminValue" DataSourceID="sdsMenuBuilder"
DataTextField="MenuText" DataValueField="Value" DataFieldID="MenuID" Width="650px"
onprerender="FarsiMenu_PreRender"
style="position:absolute;right:40px;" EnableOverlay="False" AutoScrollMinimumHeight="100" EnableAutoScroll="True">
<DefaultGroupSettings Height="200px" RepeatColumns="1" />
</telerik:RadMenu>
When I drag and drop a selected row from ASP.NET Ajax (Telerik.web.ui) Radgrid (inside a usercontrol) to a RadTreeview node (inside a usercontrol),
I am able to capture the Datakeyitem of the Radgrid on the RowDrop serverside event of the Radgrid, like
Private Sub grdEquipments_RowDrop(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDragDropEventArgs) Handles grdEquipments.RowDrop
Dim dataItem As GridDataItem = e.DraggedItems(0)
Dim s As String = dataItem.OwnerTableView().Items(dataItem.ItemIndex).GetDataKeyValue("ID")
End Sub
But I am not able to get the refrence to the Treeview Node on which the Item is being dropped.
Do you have any sample projects where you have this functinality.
please note that these two controls are in separate usercontrols.
Thanks
Madhu Rao
protected void imSearch_Click(object sender, EventArgs e)
{
TextBox txtFirstName = (TextBox)RadPanelBar1.FindItemByValue("QuickSearch").FindControl("txtFirstName");
}
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Width="100%" ExpandMode="SingleExpandedItem" Skin="Windows7" >
<Items>
<telerik:RadPanelItem Text="Quick Search" Expanded="True" runat="server" >
<Items>
<telerik:RadPanelItem runat="server" Value="QuickSearch" BorderColor="Red" >
<ItemTemplate>
<asp:Label ID="lblSearch" style="text-align:center" runat="server" Text="First Name:" Font-Bold="True" />
<telerik:RadTextBox ID="txtFirstName" runat="server" EmptyMessage="Search First Name" Skin="WebBlue" Width="130px"/>
Can anybody tell me what I'm missing.
<
telerik:RadGrid
ID
=
"rgUsers"
BorderColor
=
"#cccccc"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnItemCommand
=
"ItemCommand"
OnUpdateCommand
=
"ItemUpdated"
AllowAutomaticUpdates
=
"false"
>
<
MasterTableView
DataKeyNames
=
"adminuser_id"
Width
=
"100%"
EnableViewState
=
"false"
EditMode
=
"PopUp"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"email"
HeaderText
=
"Email Address"
HeaderStyle-Width
=
"25%"
ItemStyle-VerticalAlign
=
"Top"
ReadOnly
=
"true"
/>
<
telerik:GridTemplateColumn
HeaderText
=
"Password"
Visible
=
"false"
UniqueName
=
"colPassword"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"tbPassword"
runat
=
"server"
MaxLength
=
"30"
/>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"LinkButton"
ItemStyle-CssClass
=
"gridaction"
EditText
=
"Reset Password"
HeaderStyle-Width
=
"15%"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"False"
EnableDragToSelectRows
=
"false"
/>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
protected
void
ItemUpdated(
object
sender, GridCommandEventArgs args )
{
AdminUser user = args.Item.DataItem
as
AdminUser;
TextBox tbPassword = args.Item.FindControl(
"tbPassword"
)
as
TextBox;
SqlExecutor.Execute(
delegate
( SqlConnection connection )
{
user.password = tbPassword.Text;
user.Persist( connection );
}, logger );
}