In our grid (EditMode="Batch", InsertItemDisplay="Bottom", EditType="Cell", OpenEditingEvent="Click") we want to add a new row to the grid if the user clicks on any cell in the last row.
I made a function to call for OnBatchEditOpened. If it finds you are in the bottom row, it creates a new row below it by running batchManager.addNewRecord(masterTable)
That works, which triggers my OnRowCreated function, which I want. In there, it runs batchManager.changeCellValue for multiple columns in the new row to initialize their values.
However, each of those initializing statements (done via changeCellValue) triggers my original function for OnBatchEditOpened, creating a loop. I try to avoid it by creating temp variables outside the functions that skip that function if OnRowCreated is running. It kind of works. But even so, afterwards, the original cell is no longer in edit mode, which we want.
So now in the original call to OnBatchEditOpened, I'm storing a temp variable of the original cell, which I then try to re-open via batchManager.openCellForEdit(cellTemp), but it doesn't always work. And even when it does, the function now calls itself because a cell is being opened!
Ugh!
All that said, I must be going about this the wrong way. So back to the original issue...
Without going through dodgy javascript acrobatics, how can I click on a cell to edit it, but if it's in the bottom row, create a new row below it, yet keep (or resume?) the original cell in edit mode. There must be an easier way than what I'm doing to avoid loops, temp vars, and with robust code, but I've no clue what it is. Please help.
I have a RadPivotGrid that works perfectly in IE and Firefox but on Chrome and Safari it puts a large white column instead of the vertical scroll bar, if the number of lines does not require vertical displacement( verticalScrollBar should be set to no display).
The attached images show the difference. I've tried using a page lenght that requires vertical scroll but the last page allways has the same problem.
I'm using Telerik version 2015.2.826.40.
I've tried modify the CSS with no result.
Am i the only one with this problema? Any ideas?
Thanks for any help.
The definition of the RadPivotGrid:
<
telerik:RadPivotGrid
ID
=
"Gconsulta"
runat
=
"server"
AllowPaging
=
"True"
Width
=
"100%"
AllowFiltering
=
"true"
enableConfigurationPanel
=
"true"
<br> OnCellDataBound="Gconsulta_CellDataBound" AllowSorting="True" Skin="Default" ShowFilterHeaderZone="false" ShowColumnHeaderZone="true"<
br
> OnPivotGridCellExporting="Gconsulta_PivotGridCellExporting" ShowRowHeaderZone="false" ShowDataHeaderZone="false"<
br
> OnPivotGridBiffExporting="Gconsulta_PivotGridBiffExporting"<
br
> OnNeedDataSource="Gconsulta_NeedDataSource" PageSize="20"><
br
> <
TotalsSettings
GrandTotalsVisibility
=
"RowsOnly"
/><
br
> <
PagerStyle
Mode
=
"NumericPages"
Font-Size
=
"Small"
Font-Italic
=
"true"
<br> AlwaysVisible="true" Height="30px" BackColor="Transparent" /><
br
> <
Fields
><
br
> <
telerik:PivotGridRowField
DataField
=
"TipoCli"
Caption
=
"TipoCliente"
ZoneIndex
=
"0"
meta:resourcekey
=
"TipoCli"
><
br
> <
CellStyle
Width
=
"9%"
ForeColor
=
"Red"
Font-Size
=
"X-Small"
Font-Bold
=
"true"
></
CellStyle
><
br
> </
telerik:PivotGridRowField
><
br
> <
telerik:PivotGridRowField
DataField
=
"Cliente"
Caption
=
"Cliente"
ZoneIndex
=
"1"
<br> meta:resourcekey="Cliente"><
br
> <
CellStyle
Width
=
"16%"
ForeColor
=
"Blue"
Font-Size
=
"X-Small"
></
CellStyle
><
br
> </
telerik:PivotGridRowField
><
br
> <
telerik:PivotGridColumnField
DataField
=
"Ano"
SortOrder
=
"Descending"
meta:resourcekey
=
"Ano"
><
br
> </
telerik:PivotGridColumnField
><
br
> <
telerik:PivotGridColumnField
DataField
=
"NomeMes"
Caption
=
"Mes"
meta:resourcekey
=
"Mes"
><
br
> </
telerik:PivotGridColumnField
><
br
> <
telerik:PivotGridAggregateField
DataField
=
"Vendas"
Caption
=
"Vendas"
Aggregate
=
"Sum"
<br> DataFormatString="{0:# ##0.00 €}" GrandTotalAggregateFormatString="{0:# ##0.00 €}"<
br
> TotalFormatString="{0:# ##0.00 €}" meta:resourcekey="Vendas"><
br
> <
CellStyle
Width
=
"100px"
/><
br
> </
telerik:PivotGridAggregateField
><
br
> <
telerik:PivotGridAggregateField
DataField
=
"Quantidade"
Aggregate
=
"Sum"
GrandTotalAggregateFormatString
=
"{0:N0}"
<br> TotalFormatString="{0:N0}" meta:resourcekey="Quantidade" Caption="Quantidade"><
br
> <
CellStyle
Width
=
"80px"
/><
br
> </
telerik:PivotGridAggregateField
><
br
> <
telerik:PivotGridAggregateField
DataField
=
"Bonus"
Aggregate
=
"Sum"
GrandTotalAggregateFormatString
=
"{0:N0}"
<br> TotalFormatString="{0:N0}" meta:resourcekey="Bonus" Caption="Bonus"><
br
> <
CellStyle
Width
=
"70px"
/><
br
> </
telerik:PivotGridAggregateField
><
br
> </
Fields
><
br
> <
ClientSettings
EnableFieldsDragDrop
=
"true"
><
br
> <
Resizing
AllowColumnResize
=
"true"
EnableRealTimeResize
=
"true"
/><
br
> <
Scrolling
AllowVerticalScroll
=
"true"
SaveScrollPosition
=
"true"
ScrollHeight
=
"535px"
/><
br
> </
ClientSettings
><
br
> </
telerik:RadPivotGrid
>
Hello, I am very new to working with Telerik stuff.
I have a ComboBox that is a dropdown that gets populated from a WebServiceSettings-Method call (it querys our database and returns a RadComboBoxData object). I need to highlight some items in the dropdown with a color based on a flag in our database. I was wondering how to do this.
Is there a way to make the RadComboBox more sunken in a 3D look?
If so then please explain how to do it in detail.
Thanks!
Sincerely,
Keith Jackson
I have a column in my grid that is defined as DateTime. In the grid, it displays correctly as "01 APR 2016 14:25". When I export to Excel I get "01 APR 2016 00:00" I've tried a number of things listed, but no luck I'm using an ExportSettings-Excel-Format = "Xlsx". In my current iteration, I have no code that would modify the column just the HTML below. Based on what I've seen in the Doc, this should work, but it's not.
Thanks for any help
<
telerik:GridDateTimeColumn
HeaderText
=
"Date/Time"
UniqueName
=
"APPOINTMENTDATETIME"
DataField
=
"APPOINTMENTDATETIME"
ShowFilterIcon
=
"false"
DataType
=
"System.DateTime"
SortExpression
=
"AppointmentDateTime"
CurrentFilterFunction
=
"GreaterThanOrEqualTo"
AutoPostBackOnFilter
=
"true"
HeaderStyle-Width
=
"125px"
DataFormatString
=
"{0:dd MMM yyyy hh:mm }"
/>
I am updating Telerik ASP.NET controls Dlls in my Website from 2015.1.401.45 to 2016.1.201.25 but recevied following exception. Below error appreas for all versions after 2015.1.401.45.
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Web.UI.RadToolBarButton.CreateRenderer()
at Telerik.Web.UI.RadToolBarItem.get_ItemRenderer()
at Telerik.Web.UI.RadToolBarItem.AddAttributesToRender(HtmlTextWriter writer)
at System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter writer)
at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Control.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Hi,
I've noticed an issue with the RadRating control, when it's set to continuous and whole item selection modes, if you hover over a star for a few seconds and move the mouse downwards it leaves the control looking like a new selection has been made to users, however when we retrieve the value we get the previous values (0) in most cases. When client side validation is run, it fails saying these ratings haven't been completed, however they look complete to the user, to get past this they mus re-click a star.
This issue doesn't occur when in half item, or precision selction modes, and it's reproducible on the demo site: http://demos.telerik.com/aspnet-ajax/rating/examples/overview/defaultcs.aspx
Any ideas how to prevent this, for example, users must click to select a rating
Lee
This seems easy, but I can't figure it out. No matter what rows have been added, or how it's been ordered, I want the index of the bottom most row in the grid via client side javascript. There's no paging. It doesn't appear that get_dataItems() always have [0] as the top and [length - 1] as the bottom, so how can I get the bottom most row's index?
My RadGrid is in batch mode, and I want to update a 3rd column if the 1st or 2nd column are updated. Given my javascript and markup below, it "kind of" works, because when I update column 1 or 2 and tab off (to go to next field) it updates column 3, so that's good. But there are a couple of problems...
1) After changing column 1 or 2, when I tab off (or mouse click off) the original cell remains in edit mode and doesn't close.
2) Regardless if I change a value or not, when I hit the up or down arrow from any edittable cell, the focus moves to the row and cell above or below, as desired. However, the highlighted row selection doesn't change, but remains on the original line. This is needed as I have a javascript function (not included here but seen in the markup via OnRowSelected) that I need to call.
How do I get around these 2 problems?
3) Bonus question: Any way to get around all the data manipulation I'm doing to turn the string "1,000.0000" into number 1000 for my calculation? Seems I should be able to reference the RadNumericTextBox and simply call .get_value() but maybe that's not possible?
function
replaceString(str, oldValue, newValue) {
// The string.replace function replaces first instance; use reg exp to replace all.
var
r =
new
RegExp(oldValue,
"g"
);
// g = global, so changes them all.
return
str.replace(r, newValue);
}
function
setNumber(val) {
var
temp = replaceString(val,
','
,
''
);
// Number (and parseFloat) don't account for commas
return
Number(temp);
}
function
BatchEditCellValueChanged(sender, args) {
var
grd = sender;
var
masterTable = grd.get_masterTableView();
var
rows = masterTable.get_dataItems();
var
rowArgs = args.get_row();
var
rowIndex = rowArgs.sectionRowIndex;
var
row = rows[rowIndex];
var
batchManager = grd.get_batchEditingManager();
var
colName = args.get_columnUniqueName();
// Column that's been changed
switch
(colName) {
case
'PurchaseOrderDetailQuantity'
:
case
'UnitPrice'
:
var
qty = batchManager.getCellValue(row.get_cell(
'PurchaseOrderDetailQuantity'
));
var
unitPrice = batchManager.getCellValue(row.get_cell(
'UnitPrice'
));
var
result = setNumber(qty) * setNumber(unitPrice);
if
(result !== 0) {
// Never set the amount to zero.
batchManager.changeCellValue(row.get_cell(
'PurchaseOrderDetailAmount'
), result);
}
break
;
}
}
<
telerik:RadGrid
ID
=
"grdPODetails"
runat
=
"server"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
Skin
=
"Office2010Blue"
GridLines
=
"None"
>
<
HeaderContextMenu
EnableAutoScroll
=
"True"
>
</
HeaderContextMenu
>
<
MasterTableView
CommandItemDisplay
=
"Top"
EditMode
=
"Batch"
InsertItemDisplay
=
"Bottom"
ClientDataKeyNames
=
"PurchaseOrderDetailKey"
DataKeyNames
=
"PurchaseOrderDetailKey"
>
<
BatchEditingSettings
EditType
=
"Cell"
OpenEditingEvent
=
"Click"
/>
<
CommandItemSettings
ShowRefreshButton
=
"False"
ShowSaveChangesButton
=
"true"
ShowCancelChangesButton
=
"true"
/>
<
NoRecordsTemplate
>
No detail lines to display.
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"PurchaseOrderDetailQuantity"
HeaderText
=
"Quantity"
UniqueName
=
"PurchaseOrderDetailQuantity"
DataType
=
"System.Double"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblPurchaseOrderDetailQuantity"
runat
=
"server"
Text='<%# Eval("PurchaseOrderDetailQuantity") %>'>
</
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"txtPurchaseOrderDetailQuantity"
runat
=
"server"
DataType
=
"System.Decimal"
MaxLength
=
"23"
Width
=
"100%"
IncrementSettings-InterceptArrowKeys
=
"false"
Culture
=
"English (United States)"
DbValue='<%# Bind("PurchaseOrderDetailQuantity") %>' Type="Number" NumberFormat-DecimalDigits="4" />
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"UnitPrice"
HeaderText
=
"UnitPrice"
UniqueName
=
"UnitPrice"
DataType
=
"System.Double"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblUnitPrice"
runat
=
"server"
Text='<%# Eval("UnitPrice") %>'>
</
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"txtUnitPrice"
runat
=
"server"
DataType
=
"System.Decimal"
MaxLength
=
"23"
Width
=
"100%"
IncrementSettings-InterceptArrowKeys
=
"false"
Culture
=
"English (United States)"
DbValue='<%# Bind("UnitPrice") %>' Type="Number" NumberFormat-DecimalDigits="4" />
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"PurchaseOrderDetailAmount"
HeaderText
=
"Amount"
UniqueName
=
"PurchaseOrderDetailAmount"
DataType
=
"System.Double"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblPurchaseOrderDetailAmount"
runat
=
"server"
Text='<%# Eval("PurchaseOrderDetailAmount") %>'>
</
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"txtPurchaseOrderDetailAmount"
runat
=
"server"
DataType
=
"System.Decimal"
MaxLength
=
"21"
Width
=
"100%"
IncrementSettings-InterceptArrowKeys
=
"false"
Culture
=
"English (United States)"
DbValue='<%# Bind("PurchaseOrderDetailAmount") %>' Type="Number" NumberFormat-DecimalDigits="2" />
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridNumericColumn
DataField
=
"PurchaseOrderDetailKey"
HeaderText
=
"PurchaseOrderDetailKey"
UniqueName
=
"PurchaseOrderDetailKey"
DataType
=
"System.Int32"
Visible
=
"False"
ReadOnly
=
"True"
>
</
telerik:GridNumericColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
AllowKeyboardNavigation
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
ClientEvents
OnRowSelected
=
"RowSelected"
OnBatchEditCellValueChanged
=
"BatchEditCellValueChanged"
/>
</
ClientSettings
>
</
telerik:RadGrid
>