var ArbolPresupuestoConfigurator_ReceiveData = function (nodesConfig) {and the code caller function from child window is:
/*
nodesConfig is a object passed to the function and the following is the structure of the object
var nodesConfig = {
nodes: null,
level: '',
idFlota: 0
}
where 'nodes' is the object that contains the root node (with child nodes) from the child window.*/
if (nodesConfig != null) {
switch (nodesConfig.level) {
case 'Flota':
var nodoFlota = nodesConfig.nodes.get_nodes().getNode(0)
if (nodoFlota != null) {
var esFlotaPersonalizada = nodoFlota.get_attributes().getAttribute('EsPersonalizada');
if (esFlotaPersonalizada == 'True') {
var nombreFlota = nodoFlota.get_text();
} else {
var idFlota = nodoFlota.get_value();
//The exception is fired here from the second time the function is called.
//treeArbolPresupuesto is the parent window treeview
var _currentNodoFlota = treeArbolPresupuesto.findNodeByValue(idFlota)
if (_currentNodoFlota != null) {
if (nodoFlota.get_nodes().get_count() > 0) {
treeArbolPresupuesto.trackChanges();
var nuevaActividad = nodoFlota.get_nodes().getNode(0);
_currentNodoFlota.get_nodes().getNode(0).get_nodes().add(nuevaActividad);
treeArbolPresupuesto.commitChanges();
}
}
}
}
break;
case 'Actividad':
break;
case 'Area':
break;
case 'Sistema':
break;
case 'SubSistema':
break;
case 'Material':
break;
}
}
}
var wizardToolbar_HandleButtonClick = function (sender, eventArgs) {Actually I am very upset with this problem since I have not found a solution and I promptly deliver development.
var button = eventArgs.get_item();
var commandName = button.get_commandName();
switch (commandName) {
case 'SaveAll':
//RootNode is the root node of the treeview in child window
var rootNode = treeConfig.findNodeByValue('-100');
nodesConfig.nodes = rootNode;
GetRadWindow().BrowserWindow.ArbolPresupuestoConfigurator_ReceiveData(nodesConfig);
GetRadWindow().close();
break;
case 'Cancel':
//TODO: Pendiente implementar.
GetRadWindow().close();
break;
case 'Undo':
window.location.reload();
break;
case 'Help':
//TODO: Pendiente implementar.
break;
}
}
private
void
BindData()
{
clickedType = Session[
"type"
].ToString();
int
id = ParentEntity.ParentEntityId;
GridTableView tableView =
new
GridTableView(grv);
switch
(clickedType)
{
case
"All Categories"
:
using
(SpaceCategoriesService.SpaceCategoriesServiceClient s =
new
SpaceCategoriesService.SpaceCategoriesServiceClient())
{
grv.DataSource = s.GetCategoryTable();
tableView.Name =
"Buildings"
;
tableView.DataMember =
"Buildings"
;
}
break
;
case
"SpaceCategories"
:
using
(SpaceBuildingsService.SpaceBuildingsServiceClient s =
new
SpaceBuildingsService.SpaceBuildingsServiceClient())
{
grv.DataSource = s.GetBuildingByCategoryId(id);
tableView.Name =
"Floors"
;
tableView.DataMember =
"Floors"
;
}
break
;
case
"SpaceBuildings"
:
using
(SpaceFloorService.SpaceFloorServiceClient s =
new
SpaceFloorService.SpaceFloorServiceClient())
{
grv.DataSource = s.GetFloorsByBuildingId(id);
tableView.Name =
"Rooms"
;
tableView.DataMember =
"Rooms"
;
}
break
;
case
"SpaceFloors"
:
using
(SpaceRoomService.SpaceRoomServiceClient s =
new
SpaceRoomService.SpaceRoomServiceClient())
{
grv.DataSource = s.GetRoomByFloorId(id);
}
break
;
default
:
throw
new
Exception(
"Unable to identify Entity."
);
}
grv.MasterTableView.DetailTables.Clear();
grv.MasterTableView.DetailTables.Add(tableView);
grv.DataBind();
foreach
(GridDataItem item
in
grv.Items)
{
if
(tableView.Name !=
""
)
{
LinkButton lnkExpand = (LinkButton)grv.Items[item.ItemIndex].FindControl(
"lnkExpand"
);
lnkExpand.Text =
"Show "
+ tableView.Name;
}
}
GridTableView tab =
new
GridTableView(grv);
tab.DataMember =
"Rooms"
;
tab.Name =
"Rooms"
;
tableView.DetailTables.Clear();
tableView.DetailTables.Add(tab);
}
protected
void
grv_DetailTableDataBind(
object
sender, GridDetailTableDataBindEventArgs e)
{
try
{
GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
string
datamem = e.DetailTableView.DataMember;
if
(!
string
.IsNullOrEmpty(e.DetailTableView.DataMember))
{
switch
(e.DetailTableView.DataMember)
{
case
"Buildings"
:
int
CategoryID =
int
.Parse(dataItem.GetDataKeyValue(
"Id"
).ToString());
DataTable buildings;
using
(SpaceBuildingsService.SpaceBuildingsServiceClient s =
new
SpaceBuildingsService.SpaceBuildingsServiceClient())
{
buildings = s.GetBuildingByCategoryId(CategoryID);
}
e.DetailTableView.DataSource = buildings;
break
;
case
"Floors"
:
int
BuildingID =
int
.Parse(dataItem.GetDataKeyValue(
"Id"
).ToString());
DataTable floors;
using
(SpaceFloorService.SpaceFloorServiceClient s =
new
SpaceFloorService.SpaceFloorServiceClient())
{
floors = s.GetFloorsByBuildingId(BuildingID);
}
e.DetailTableView.DataSource = floors;
break
;
case
"Rooms"
:
int
FloorID =
int
.Parse(dataItem.GetDataKeyValue(
"Id"
).ToString());
DataTable rooms;
using
(SpaceRoomService.SpaceRoomServiceClient s =
new
SpaceRoomService.SpaceRoomServiceClient())
{
rooms = s.GetRoomByFloorId(FloorID);
}
e.DetailTableView.DataSource = rooms;
break
;
default
:
break
;
}
}
}
catch
(Exception ee)
{
string
asd = ee.Message;
//throw new Exception("Unable to load!");
}
}
If I have both paging and grouping enabled on the same grid, the page gets cut off on the grid, so that the paging selector on the bottom of the grid sometimes doesn't show up at all, and sometimes will be partially cut off. If I remove the grouping functionality, the paging works 100%. I definitely need paging, as the grid is not very tall, so the data cannot be contained on one page. I've tried seting the height of the grid, and setting the page size to something ridiculously low like 3, but the paging control still gets at least partially cut off, so I dont see how to get the grid working properly with both paging and grouping.
heres the code for the grid that is being cut off:
<telerik:RadGrid ID="RadGrid2" runat="server" AllowSorting="true" AutoGenerateColumns="false"PageSize="4" AllowPaging="True" OnNeedDataSource="RadGrid2_NeedDataSource" Height="300px" ShowGroupPanel="false">
<MasterTableView>
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="FiscalYear" FieldName="FiscalYear" FormatString="{0:D}"HeaderValueSeparator=": "></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="FiscalYear" SortOrder="Descending"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="Month" FieldName="Month" FormatString="{0:D}"
HeaderValueSeparator=": "></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="Month" SortOrder="Ascending"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridBoundColumn SortExpression="FiscalYear" HeaderText="Fiscal Year" DataField="FiscalYear" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Month" HeaderText="Month" DataField="Month" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Forecast" HeaderText="Forecast" DataField="Forecast" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Actuals" HeaderText="Actuals" DataField="Actuals" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<PagerStyle Mode="NextPrev">
</PagerStyle>
</telerik:RadGrid>