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
>
Is it possible to format a RadNumericTextbox like the attached image? Setting BoardStyle="None" achieves part of what I am looking for but I need it at least on the bottom or possibly have it masked so it appears like the image.
We have several forms so I would like to set it in one spot in order to affect all the input boxes.
Any suggestions?
Hi Team,
I am using the Telerik Radgrid to populate the data from Database in 2 level Hierarchical (Master and Details) as below. I want to reorder the rows similar to Column on client side without Postback to the server.
Also I want to save the Grid data changes at once to the Database on a ASP.Net Button Click.
Could you please help me.
Thanks,
Sujana.
<telerik:RadGrid ID="RadDetails" runat="server" AutoGenerateColumns="False" AutoGenerateHierarchy="True" GroupPanelPosition="Top"
OnDetailTableDataBind="RadDetails_DetailTableDataBind" Style="overflow: hidden" Height="600px" OnBatchEditCommand="RadDetails_BatchEditCommand"
OnItemCreated="RadDetails_ItemCreated">
<ClientSettings AllowColumnsReorder="true" AllowExpandCollapse="true" AllowRowsDragDrop="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="Reorder">
<Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
<Resizing AllowColumnResize="true" EnableRealTimeResize="true" AllowResizeToFit="true" ResizeGridOnColumnResize="true" />
<ClientEvents OnRowClick="RowClicked" OnRowDropping="onRowDropping" OnRowDropped="OnRowDropped" />
</ClientSettings>
<MasterTableView HierarchyLoadMode="Client" HierarchyDefaultExpanded="true" ClientDataKeyNames="DisplayOrder" DataKeyNames="DisplayOrder" EditMode="Batch" TableLayout="Fixed">
<HeaderStyle Font-Bold="true" Wrap="false" />
<ItemStyle Wrap="false" Width="200px" />
<BatchEditingSettings EditType="Cell" SaveAllHierarchyLevels="true" OpenEditingEvent="DblClick" />
<Columns>
<telerik:GridBoundColumn ItemStyle-Font-Bold="true" HeaderText="" DataField="OrderFormSubCategory"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Category Notes" DataField="CategoryNotes"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="DisplayOrder" DataField="DisplayOrder" Visible="false"></telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView DataKeyNames="OrderFormSubCategory" runat="server" Name="Details" AutoGenerateColumns="false" EditMode="Batch" HierarchyLoadMode="Client">
<HeaderStyle Font-Bold="true" Wrap="false" Width="100px" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Middle" />
<AlternatingItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Middle" />
<BatchEditingSettings EditType="Cell" OpenEditingEvent="DblClick" />
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="OrderFormSubCategory" MasterKeyField="DisplayOrder" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn HeaderText="Order Form Sub Category" DataField="OrderFormSubCategory" Visible="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="ISBN" DataField="ISBN" HeaderStyle-Width="100px" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="ISBN13" DataField="ISBN13" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Shot Title" DataField="TitleDesc" ReadOnly="true" Resizable="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Author" DataField="Author" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Indent" UniqueName="Indent" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox ID="chkIndent" runat="server" Checked='<%# Eval("IsIndent") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Format" DataField="Format" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="RRP" DataField="RRP" ReadOnly="true" DataType="System.Decimal" DataFormatString="{0:F2}"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Featured Title" UniqueName="FeaturedTitle">
<ItemTemplate>
<asp:CheckBox ID="chkFeaturedttl" runat="server" Checked='<%# Eval("IsShaded") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Notes" HeaderStyle-Width="200px" DataField="Notes"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Page After" UniqueName="PageAfter">
<ItemTemplate>
<asp:CheckBox ID="chkPageAfter" runat="server" Checked='<%# Eval("NewPageAfter") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="LocalAuthor" UniqueName="LocalAuthor">
<ItemTemplate>
<asp:CheckBox ID="chkLocalAuthor" runat="server" Checked='<%# Eval("IsAustAuthor") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Order" DataField="DisplayOrder" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Boxed" DataField="Boxed"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="BIC" DataField="BIC" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Series" DataField="Series" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Page Extent" DataField="PageExtent" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Long Title" DataField="LongTitle" ReadOnly="true"></telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
I am transitioning my charts from another third party product to the RadHTMLChart and the only functionality that I can't quite get to work is getting a proper buffer between the bottom of the chart and the beginning of my data. I wanted to have clean, rounded number increments on the YAxis so I rounded my min value down (e.g. 5,187 to 5,000) but now I want a larger buffer on the bottom between my first MajorTickLine and the X-Axis. Attached is an image of the old chart that I want to replicate. Notice that the XAxis does not have a value itself but the first YAxis tick line does.
Any help is appreciated.
Hi,
I am using geoJSON type in the layers object of kendoMap chart.
I need to place the country names along with some custom data on the country in map (only on some countries, not all).
I have attached the sample of the same.
How can I achieve this.
Thanks
Sunny Karwal
I have used telerik radgrid in my application. I have data in the form of queryable collection. I have enablelinqexpression set to true.
So when i use endswith filter i get an expression in the form of : (iif(User == null, "", User).ToString().ToUpper().EndsWith("system".ToUpper()))
Where user is the column name and system is the string that needs to be searched for.
I am passing the filter expression to the where condition of my collection as shown : filteredItems.Where(filterExpression);
My filteredItems collection already have records and also those records that endswith system.
But it still returns zero count or records.
The filter expression is working in case of startswith, is not null, is null. But not working for few of the filters like endswith, contains etc.
After upgrading Telerik to the latest version, it appears that RadWindows with a Lightweight render mode do not render at dimensions specified in the <telerik:RadWindow> tag. While I was using a custom skin when I started testing, I ultimately removed all skins from the window (that is, I set "EnableEmbeddedSkins" to false and then did not specify a skin) in an attempt to narrow down the problem.
With no skin at all, a RadWindow with attributes of "Width='338px' and Height='309px'" rendered with the correct height, but was 368 pixels wide. Incidentally, the inline style applied to the RadWindowWrapper in the output HTML markup was 352 pixels, which rules out a CSS issue because this value is also wrong.
Next, I tried removing the dimension attributes, meaning that the window should have rendered with the default dimensions of 300 pixels by 300 pixels. Instead, it rendered at 330 x 300 pixels, with an inline height of 314 pixels. So the dimensions are, at least, consistently wrong.
Why is this happening, and what can I do to get a RadWindow to render at the dimensions set in its attributes?
On a related note: the aforementioned custom skin I was using when I started test has a "padding:0;" applied to the RadWindow, because I do not want the window to have any borders. With that styling applied, the height of the RadWindow also does not match the height set in the RadWindow's attribute. I assume these problems are related.