Hi,
I have managed to successfully create Pivot Grids from code behind, the definition of the pivot grid, rows, columns and aggregates and filters are stored in SQL Server, I am able to easily create the grid at run time and display it. The sorting, column filters, row filters all work well. However the PivotGridReportFilterField defined when clicked fail with
[NullReferenceException: Object reference not set to an instance of an object.] Telerik.Web.UI.PivotGridFilterWindow.InitializeControls() +904 Telerik.Web.UI.PivotGridFilteringManager.CreateFilterWindow() +90 Telerik.Web.UI.PivotGridFilteringManager.SetUpFilterWindowControls() +14 Telerik.Web.UI.RadPivotGrid.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +723
In the code behind, I construct the grid as follows:
foreach
(var def
in
defList)
{
if
(def.ReportFieldType == (
int
) ReportFieldType.RowFieldForTable)
{
// Define Rows var rowField = new PivotGridRowField();
PivotGrid.Fields.Add(rowField);
rowField.DataField = def.Fieldname;
rowField.UniqueName = def.Fieldname.Replace(
" "
,
string
.Empty);
}
else
if
(def.ReportFieldType == (
int
) ReportFieldType.ColumnFieldForTable)
{
// Define Columns var colField = new PivotGridColumnField();
PivotGrid.Fields.Add(colField);
colField.DataField = def.Fieldname;
colField.UniqueName = def.Fieldname.Replace(
" "
,
string
.Empty);
}
else
if
((def.ReportFieldType == (
int
) ReportFieldType.CountFieldForTable) || (def.ReportFieldType == (
int
) ReportFieldType.AverageFieldForTable) || (def.ReportFieldType == (
int
) ReportFieldType.SumFieldForTable))
{
//Define Aggregrates var aggregateField = new PivotGridAggregateField();
PivotGrid.Fields.Add(aggregateField);
aggregateField.DataField = def.Fieldname;
aggregateField.UniqueName = def.Fieldname.Replace(
" "
,
string
.Empty);
if
(def.ReportFieldType == (
int
) ReportFieldType.CountFieldForTable) aggregateField.Aggregate = PivotGridAggregate.Count;
if
(def.ReportFieldType == (
int
) ReportFieldType.AverageFieldForTable) aggregateField.Aggregate = PivotGridAggregate.Average;
if
(def.ReportFieldType == (
int
) ReportFieldType.SumFieldForTable) aggregateField.Aggregate = PivotGridAggregate.Sum;
}
else
if
(def.ReportFieldType == (
int
) ReportFieldType.FilterFields)
{
var filterField =
new
PivotGridReportFilterField();
PivotGrid.Fields.Add(filterField);
filterField.DataField = def.Fieldname;
filterField.UniqueName = def.Fieldname.Replace(
" "
,
string
.Empty);
//filterField.FilterType = PivotGridReportFilterActionType.Includes; }
}
Any help in resolving this issue would be much appreciated.
Thanks
Hi,
I'm using the following method to export a radgrid report to Excel:
ExportSettings-Excel-Format="Xlsx"
and in the codebehind:
protected
void
btnExport_Click(
object
sender, EventArgs e)
{
rgLTDAccount.ExportSettings.OpenInNewWindow =
true
;
rgLTDAccount.ExportSettings.IgnorePaging =
true
;
rgLTDAccount.ExportSettings.UseItemStyles =
true
;
rgLTDAccount.ExportSettings.FileName =
lblFileName.Text;
rgLTDAccount.ExportSettings.ExportOnlyData =
false
;
rgLTDAccount.MasterTableView.ExportToExcel();
}
I'm trying to insert a custom header at the top of the report with a few rows of contextual data from codebehind. I've seen some samples for html and biff, but not xlsx format. I can adjust a few things like row height in the InfrastructureExporting method, but I can't figure out if it's possible to insert rows and add text to them. Any help greatly appreciated.
Thanks.
-Dan
manager.AjaxSettings.AddAjaxSetting(
this.dvPageDetail, this.dvPageDetail, LoadingPanel);
oAjax.AjaxSettings.AddAjaxSetting(cmbContent, cmbSubContent, LdingPnl1);
Greetings,
I have two user controls A and B. B is a standalone grid that is displayed in some areas, while A is a grid that expands the rows and the NestViewTemplate is the user control B.
Now A and B both have an RadAjaxLoadingPanel and RadAjaxManagerProxy and B shows the loading indicator just fine when used by itself. And user control A shows the loading indicator for its primary RadGrid just fine as you navigate paging or expand, and sort etc. However once you expand a row the nest RadGrid inside user control B no longer shows a loading indicator like it does when it is not nested.
So I have the RadAjaxLoadingPanel and RadAjaxManagerProxy setup correctly for RadGrid in a non-nested situation. This is an example of what the NestedViewTemplate looks like.
1.
<
NestedViewTemplate
>
2.
<
div
class
=
"childGrid"
runat
=
"server"
>
3.
<
uc:MyChildGrid
ID
=
"childGrid"
runat
=
"server"
ShowTitle
=
"False"
ShowSummery
=
"False"
OnQueryStateChange
=
"ChildGridOnQueryStateChange"
/>
4.
</
div
>
5.
</
NestedViewTemplate
>
Is there anything special that has to be taken into account to have the loading indicators both work on both controls? It doesn't make sense why they work in isolation but not when nested as user controls. I have unique ID's on the proxies and the Loading Panels in case there could be a collision. Seems like they should be independent RadAjaxManagerProxy and RadAjaxLoadingPanel and should just work they way they do in isolation when nested.
I looked at the Demo's and there are none using User Controls for nesting. They are all nested Rad controls and only a single RadAjaxLoadingPanel and RadAjaxManager they don't use the Proxy version.
Not sure if there is some secret sauce that needs to be added or exposed on the nested custom user control that will allow for it to be hooked and managed.
Any help that can solve this will be appreciated!
Thanks!
Is there any way to make a GridButtonColumn visible or not based on bound data?
Cheers, Rob.
I'm new to AJAX controls for ASP.NET ... I'm trying out RadPageLayout and can't seem to accomplish the most simple of tasks ... just have a control centered in a column. In fact I can't find any property in LayoutColumn that has anything to do with alignment?
<
telerik:RadPageLayout
ID
=
"RadPageLayout1"
runat
=
"server"
GridType
=
"Fluid"
BorderWidth
=
"1px"
Width
=
"300"
>
<
Rows
>
<
telerik:LayoutRow
RowType
=
"Row"
>
<
Columns
>
<
telerik:LayoutColumn
>
<
telerik:RadLabel
ID
=
"rlb_Online"
runat
=
"server"
Text
=
"Online"
/>
</
telerik:LayoutColumn
>
</
Columns
>
</
telerik:LayoutRow
>
</
Rows
>
</
telerik:RadPageLayout
>
Any hints? I've read thru the documentation on RadPageLayout and LayoutRow and LayoutColumn but NOT a single mention of alignment or setting margins for rows and I can't find any property setting that would accomplish this? I guess I'm missing something very obvious with this control?
Cheers, Rob.
I have a View (name = 'step3Grid'). It's using popup with a Template ("_VendorQuotationTmp")
01.
@(
02.
Html.Kendo().Grid<VendorQuotationDto>()
03.
.Name(
"step3Grid"
)
04.
.Columns(columns =>
05.
{
06.
columns.Bound(p => p.VendorName).Title(LanguageData[
"L-00323"
])
07.
.HtmlAttributes(
new
{ style =
"text-align:left;"
})
08.
.HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
, title = LanguageData[
"L-00323"
] });
09.
columns.Bound(p => p.PurchaseOrderName).Title(LanguageData[
"L-00284"
])
10.
.HtmlAttributes(
new
{ style =
"text-align: left"
})
11.
.ClientTemplate(
"#=PurchaseOrderName.toString().split('-').pop()#"
)
12.
.HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
, title = LanguageData[
"L-00284"
] });
13.
columns.Bound(p => p.HasAttachedFile).Title(LanguageData[
"L-00060"
])
14.
.ClientTemplate(
"#if (HasAttachedFile && HasPDFAttachedFile) {#<img src='"
+ @Url.Content(
"/Content/images/common/pdf.png"
) +
"' alt='PDF File' height='16' width='16' class='icon-file-attached' title='#=Attachment#'>#}# #if (HasAttachedFile && !HasPDFAttachedFile) {#<img src='"
+ @Url.Content(
"/Content/images/common/paperclip.png"
) +
"' alt='Attached File' height='16' width='16' class='icon-file-attached' title='#=Attachment#'>#}#"
)
15.
.HtmlAttributes(
new
{ @onclick =
"clickImagePDF('#=Attachment#'); return false;"
})
16.
.HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
, title = LanguageData[
"L-00060"
] }).Width(
"65px"
);
17.
18.
columns.Command(c =>
19.
{
20.
c.Edit().HtmlAttributes(
new
{ title = LanguageData[
"B-00003"
] });
21.
c.Destroy().HtmlAttributes(
new
{ title = LanguageData[
"B-00004"
] });
22.
})
23.
.Title(LanguageData[
"L-00000"
])
24.
.Width(
"100px"
)
25.
.HtmlAttributes(
new
{ style =
"text-align: center;"
})
26.
.HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
});
27.
})
28.
.Events(e => e.Edit(
"onEditVendorQuo"
).Save(
"onSaveVendorQuo"
)
/*.DetailExpand("onExpandVendorQuo")*/
)
29.
.Editable(e =>
30.
{
31.
e.Mode(GridEditMode.PopUp).TemplateName(
"_VendorQuotationTmp"
);
32.
e.DisplayDeleteConfirmation(LanguageData[
"N-00019"
]);
33.
})
34.
.ToolBar(toolbar =>
35.
{
36.
toolbar.Create().Text(LanguageData[
"B-00001"
]);
37.
})
38.
//.ClientDetailTemplateId("template")
39.
.Sortable()
40.
.Selectable()
67.
.Scrollable(a => a.Height(
"auto"
))
68.
.DataSource(dataSource => dataSource
69.
.Ajax()
70.
.PageSize(30)
71.
.Model(model =>
72.
{
73.
model.Id(p => p.Id);
74.
})
75.
.Read(read => read.Action(
"ReadVendorQuotation"
,
"PurchaseOrder"
,
new
{ MrId = Model.MaterRequisId, @area =
"Ship"
}).Type(HttpVerbs.Post))
76.
.Create(create => create.Action(
"CreateVendorQuotation"
,
"PurchaseOrder"
,
new
{ @area =
"Ship"
, shipId = ViewBag.ShipId }).Type(HttpVerbs.Post).Data(
"getParamVendorQuo"
))
77.
.Update(update => update.Action(
"UpdateVendorQuotation"
,
"PurchaseOrder"
,
new
{ @area =
"Ship"
, shipId = ViewBag.ShipId }).Type(HttpVerbs.Post).Data(
"getParamVendorQuo"
))
78.
.Destroy(des => des.Action(
"DeleteVendorQuotation"
,
"PurchaseOrder"
,
new
{ @area =
"Ship"
, shipId = ViewBag.ShipId }).Type(HttpVerbs.Post))
79.
.Events(e => e.RequestStart(
"onRequestStartStep3"
).RequestEnd(
"onRequestEndStep3"
))
80.
))
Inside the popup ("_VendorQuotationTmp"),
01.
@(Html.Kendo().Grid<RequestQuoDetailDto>()
02.
.Name(
"vendorquodetailGrid"
)
03.
.Columns(columns =>
04.
{
05.
columns.Bound(p => p.PartCode).Title(LanguageData[
"L-00167"
])
06.
.HtmlAttributes(
new
{ style =
"text-align:left;"
})
07.
.HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
, title = LanguageData[
"L-00167"
] }).Width(
"10%"
);
08.
columns.Bound(p => p.PartName).Title(LanguageData[
"L-00168"
])
09.
.ClientTemplate(
"#=PartName# "
).Width(
"38%"
)
10.
.HtmlAttributes(
new
{ style =
"text-align: left"
}).HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
, title = LanguageData[
"L-00168"
] });
11.
columns.Bound(p => p.Price).Title(LanguageData[
"L-00288"
]).HtmlAttributes(
new
{ style =
"text-align: left"
})
.EditorTemplateName("DecimalRound1")
12.
.HeaderHtmlAttributes(
new
{ style =
"text-align:center; font-weight:bold"
, title = LanguageData[
"L-00288"
] }).Width(
"12%"
);
13.
14.
columns.Bound(p => p.FullGroupName).ClientGroupHeaderTemplate(
" #= value #"
).Hidden();
15.
})
16.
.Events(e => e.Save(
"onSaveVendorQuoDetail"
))
17.
.Editable(e => e.Mode(GridEditMode.InCell))
18.
.Groupable()
19.
.Sortable()
20.
.Selectable()
21.
.Pageable(p => p.Messages(mes =>
22.
{
23.
mes.Display(LanguageData[
"N-00067"
]);
24.
mes.Empty(LanguageData[
"N-00068"
]);
25.
mes.Previous(LanguageData[
"B-00038"
]);
26.
mes.Next(LanguageData[
"B-00039"
]);
27.
mes.First(LanguageData[
"B-00040"
]);
28.
mes.Last(LanguageData[
"B-00041"
]);
29.
}))
30.
.Filterable(filterable => filterable
31.
.Extra(
false
)
32.
.Messages(m => m.Info(LanguageData[
"B-00035"
])
33.
.Filter(LanguageData[
"B-00036"
])
34.
.Clear(LanguageData[
"B-00037"
]))
35.
.Operators(operators => operators
36.
.ForNumber(str => str.Clear()
37.
.IsEqualTo(LanguageData[
"B-00033"
])
38.
.IsNotEqualTo(LanguageData[
"B-00034"
])
39.
)
40.
.ForString(str => str.Clear()
41.
.Contains(LanguageData[
"B-00031"
])
42.
.StartsWith(LanguageData[
"B-00032"
])
43.
.IsEqualTo(LanguageData[
"B-00033"
])
44.
.IsNotEqualTo(LanguageData[
"B-00034"
])
45.
))
46.
)
47.
.Scrollable(a => a.Height(
"400px"
))
48.
.AutoBind(
false
)
49.
.DataSource(dataSource => dataSource
50.
.Ajax()
51.
.Group(g => g.Add(f => f.FullGroupName))
52.
.ServerOperation(
false
)
53.
.PageSize(20)
54.
.Model(model =>
55.
{
56.
model.Id(p => p.QuotationDetailId);
57.
model.Field(f => f.PartCode).Editable(
false
);
58.
model.Field(f => f.PartName).Editable(
false
);
59.
})
60.
.Read(read => read.Action(
"ReadDetailVendorQuo"
,
"PurchaseOrder"
,
new
{ @area =
"Ship"
}).Type(HttpVerbs.Post))
61.
))
At column 'Price' of Grid. I applied EditorTemplate cho it and Price is double?. When I run program, I got error and popup can open. If I remove EditorTemplate of column 'Price' then program can run and this column is type ='text' not 'number'
Can you tell me why is it ? You don't care about 'LanguageData'. I am not good English. If I have any misspelling, please forgive me. Thanks.
Using the below for a sheduler:
<telerik:RadScheduler RenderMode="Lightweight" runat="server" ID="RadScheduler1" DayStartTime="08:00:00" AdvancedForm-Enabled="false" Skin="Glow"
DayEndTime="18:00:00" DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentId" SelectedView="MonthView" DayView-UserSelectable="false" MonthView-UserSelectable="true" TimelineView-UserSelectable="false" WeekView-UserSelectable="false"
DataReminderField="Reminder" Width="800" >
</telerik:RadScheduler>
What i want to do is, when i click on a day i am taken to a new aspx page. There doesnt seem to be an onclick event for the days. I have tried RadScheduler1_TimeSlotContextMenuItemClicked and RadScheduler1_TimeSlotContextMenuItemClicking but they dont work
I've been following https://demos.telerik.com/aspnet-ajax/editor/examples/validators/defaultcs.aspx to enable validation on my RadEditor control to make sure (1) it is not empty and (2) the entered content length is larger than a certain amount of characters. The RadEditor control is on a (.ascx). The validation happens when you click the update button.
It seems to be working when there are no text entered, but when I enter any text of any length it stills shows me the empty text message and clears the editor control text.
<table id="" style="border-collapse: collapse; border: 0; width: 100%">
<tr class="EditFormHeader">
<td colspan="3">
<b>Ticket Details</b>
</td>
<td>
<telerik:RadButton ID="btnUpdateTicket" runat="server" ValidationGroup="ValidateInput" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></telerik:RadButton>
</td>
</tr>
<tr>
<td class="auto-style2">Notes:</td>
<td colspan="3">
<telerik:RadEditor ID="fldNote" runat="server" RenderMode="Lightweight" Skin="Metro" Width="98%" Height="200px" EditModes="Design" ContentFilters="RemoveScripts" >
<Tools>
<telerik:EditorToolGroup Tag="MainToolbar">
<telerik:EditorTool Name="FindAndReplace" />
<telerik:EditorSeparator />
<telerik:EditorSplitButton Name="Undo">
</telerik:EditorSplitButton>
<telerik:EditorSplitButton Name="Redo">
</telerik:EditorSplitButton>
<telerik:EditorSeparator />
<telerik:EditorTool Name="Cut" />
<telerik:EditorTool Name="Copy" />
<telerik:EditorTool Name="Paste" ShortCut="CTRL+V / CMD+V" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup Tag="Formatting">
<telerik:EditorTool Name="Bold" />
<telerik:EditorTool Name="Italic" />
<telerik:EditorTool Name="Underline" />
<telerik:EditorSeparator />
<telerik:EditorSplitButton Name="ForeColor">
</telerik:EditorSplitButton>
<telerik:EditorSplitButton Name="BackColor">
</telerik:EditorSplitButton>
<telerik:EditorSeparator />
<telerik:EditorDropDown Name="FontName">
</telerik:EditorDropDown>
<telerik:EditorDropDown Name="RealFontSize">
</telerik:EditorDropDown>
</telerik:EditorToolGroup>
</Tools>
</telerik:RadEditor>
<asp:RequiredFieldValidator ID="NoteValidator" runat="server" Display="Static" CssClass="validator" ControlToValidate="fldNote">Please add a note!</asp:RequiredFieldValidator>
<%-- <asp:CustomValidator runat="server" ID="EditorLengthValidator" ControlToValidate="fldNote" Display="Static" CssClass="validator" ClientValidationFunction="TelerikDemo.checkLength">***Your note is too short!!***</asp:CustomValidator><br />--%>
If commented out the CustomValidator controls to eliminate it as an issue, so now it doesn't have to check the lenght.
I'm using version 2018.3.910.45 of the ASP.NET AJAX controls.
I've gone through some of the thread, but not helped so far.