We have a rad grid.We are binding the grid using datatable and auto generated columns are true.
We want to add all the cell values and display the sum of all the cell values in other column when cell click.
we have tried with row selected event but the sum is not displaying properly when moving from one cell to other.
Please help us to fix the issue.
1. We are
able to fetch the selected cell value but unable to fetch the remaining
corresponding cell values. You can find the same in the sample project
(BatchEdit.aspx – OnBatchEditCellValueChanged event)
2. We are
able to fetch the selected cell value and corresponding cell values in the same
row by hardcoding the column names, but dynamically we are unable to get the
values of the cell. You can find the same in the sample project
(OnRowSelected.aspx – OnRowSelected event)
we have used the following code
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function RowSelected(sender, eventArgs) {
var grid = sender;
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
var cell1 = MasterTable.getCellByColumnUniqueName(row, "Value1");
var cell2 = MasterTable.getCellByColumnUniqueName(row, "Value2");
var cell3 = MasterTable.getCellByColumnUniqueName(row, "Value3");
var cell4 = MasterTable.getCellByColumnUniqueName(row, "Value4");
var total = 0;
var arr = [];
var total = 0;
var columnlength = grid.get_masterTableView().get_columns().length;
for (i = 0 ; i < columnlength; i++) {
cell = grid.get_masterTableView().get_columns()[i].get_uniqueName();
var cell = MasterTable.getCellByColumnUniqueName(row, cell);
var val = parseInt(cell.innerText);
arr[i] = val;
}
for (i = 1; i < arr.length; i++) {
total += arr[i];
}
var cell1 = MasterTable.getCellByColumnUniqueName(row, "Sum");
cell1.innerText = total;
cell1.eventArgs.set_cancel(true);
}
</script>
<%-- var grid = $find("<%=RadGrid1.ClientID%>");
var tableView = sender.get_masterTableView();
var batchManager = sender.get_batchEditingManager();
var items = tableView.get_dataItems();
var mapValues = [];
for (var i = 0; i < items.length; i++) {
var mapCell = items[i].get_cell("Map");
var mapValue = batchManager.getCellValue(mapCell);
mapValues.push(mapValue);
}--%>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
<asp:HiddenField ID="HiddenField1" runat="server" />
<div>
<telerik:RadGrid ID="RadGrid1" runat="server">
<MasterTableView EditMode="Batch" BatchEditingSettings-EditType="Cell" >
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="True" CellSelectionMode="MultiCell" />
<ClientEvents OnRowClick="RowSelected" />
</ClientSettings>
</telerik:RadGrid>
</div>
</form>
</body>
</html>
and code behind is
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class OnRowSelected : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GetValues();
}
private void GetValues()
{
DataTable dtTable = new DataTable();
dtTable.Columns.Add("Sum");
dtTable.Columns.Add("Value1"); dtTable.Columns.Add("Value2");
dtTable.Columns.Add("Value3"); dtTable.Columns.Add("Value4");
DataRow dr = dtTable.NewRow();
dr["Sum"] = "";
dr["Value1"] = "1"; dr["Value2"] = "2";
dr["Value3"] = "3"; dr["Value4"] = "4";
dtTable.Rows.Add(dr);
DataRow drr = dtTable.NewRow();
drr["Sum"] = "";
drr["Value1"] = "5"; drr["Value2"] = "6";
drr["Value3"] = "7"; drr["Value4"] = "8";
dtTable.Rows.Add(drr);
RadGrid1.DataSource = dtTable;
RadGrid1.DataBind();
}
}
Any other information please contact us.
Hi
Is there a equivalent to the $(document).on function for the clientSelectedIndexChanging and clientSelectedIndexChanged events for a RadCombobox in jQuery?
Hi,
I have radgrid with the possibility of adding a line.
One column is of GridDropDownColumn.
How to play the DropDown ??
Thank you.
We recently updated to the newest version 2015.2.729.40 and our Rotator image onclick doesn't work in Chrome and doesn't work on some machines in IE.
We had <asp:Image controls in our rotator which are rendered as <mg
To correct this, we had to change the control type to <asp:ImageButton which renders as <input
Again, this issue only happened after our recent updated to version 2015.2.729.40
Simplified example below
<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default1.aspx.vb" Inherits="TestWebRoot._Default" %>
<!DOCTYPE html>
<
html
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadStyleSheetManager
ID
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
telerik:RadRotator
ID
=
"RadRotator1"
runat
=
"server"
Height
=
"300px"
Width
=
"823px"
BackColor
=
"White"
ScrollDuration
=
"5000"
FrameDuration
=
"10000"
ItemHeight
=
"300px"
ItemWidth
=
"823px"
PauseOnMouseOver
=
"true"
RotatorType
=
"SlideShow"
ScrollDirection
=
"Left"
BorderWidth
=
"0px"
SlideShowAnimation-Type
=
"CrossFade"
WrapFrames
=
"False"
>
<
Items
>
<
telerik:RadRotatorItem
>
<
ItemTemplate
>
<
table
style
=
"position: relative;"
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
<
div
class
=
"Center ProductLabel"
style
=
"width: 100%; height: 20px;"
>
img control
</
div
>
<
img
id
=
"Img2"
runat
=
"server"
src
=
"~/images/logo.jpg"
style
=
"width: 50px; height: 50px;"
alt
=
"My Image"
onclick
=
"alert('here'); return false;"
title
=
"MyTitle"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
div
class
=
"Center ProductLabel"
style
=
"width: 100%; height: 20px;"
>
ImageButton
</
div
>
<
asp:ImageButton
ID
=
"Image1"
runat
=
"server"
style
=
"width: 50px; height: 50px;"
AlternateText
=
"My Image"
ImageUrl
=
"~/images/logo.jpg"
OnClientClick
=
"alert('here'); return false;"
/>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadRotatorItem
>
</
Items
>
</
telerik:RadRotator
>
Test Image outside Rotator
<
img
id
=
"Img1"
runat
=
"server"
class
=
"Link"
src
=
"~/images/logo.jpg"
onclick
=
"alert('here');"
/>
</
form
>
</
body
>
</
html
>
I am having a strange problem. First let me start by saying that I am using the Telerik controls supplied by DotNetNuke. So I can not "upgrade" to any other version of the Telerik controls. I am stuck with what I am given.
I wrote a module initially using Telerik v2012.2.724.35 (which was bundled with DNN v6.02.09)and it worked great. I unfortunately am forced to upgrade to a new DNN version because of a bog in Telericks RADSchedule (which effect the month of November only). So...now I am running DNN that comes with Telerik v2013.1.403.40
The problem is that when I click on a button inside the RADGrid and the ItemCommand event fires, previously I was able to obtain the value of each cell in the row that the button was activated in. The *same exact code* running in v2013.1.403.40 of Telerick now returns to me " " for every single cell in the row. It's like the new Telerik version doesn't bind the data to the GridDataItem (e.Item) within the ItemCommand event like it used to.
What am I missing? How do I get the selected row's data like I had before?
I have a HTMLChart that I would like to allow a user to right click on a point on the graph and set a start date and then right click on a second point and set the end date. After the points are set it would then pass the dates into a stored procedure and update the HTMLChart. How would I go about doing this? The chart is currently being populated via server-side code.
<
telerik:RadHtmlChart
ID
=
"RadHtmlChart1"
runat
=
"server"
Visible
=
"false"
Legend-Appearance-Position
=
"Top"
Width
=
"95%"
>
<
ClientEvents
OnLoad
=
"BottomXAxisLabels"
OnSeriesClick
=
"OnSeriesClick"
/>
<
PlotArea
>
<
Series
>
<
telerik:ScatterLineSeries
DataFieldY
=
"ReturnedValue"
DataFieldX
=
"cycle_Date"
>
<
TooltipsAppearance
Color
=
"White"
>
</
TooltipsAppearance
>
<
LabelsAppearance
Visible
=
"false"
>
</
LabelsAppearance
>
</
telerik:ScatterLineSeries
>
</
Series
>
<
YAxis
>
<
LabelsAppearance
>
<
TextStyle
Bold
=
"true"
/>
</
LabelsAppearance
>
<
MinorGridLines
Visible
=
"false"
></
MinorGridLines
>
<
MajorGridLines
Visible
=
"false"
></
MajorGridLines
>
</
YAxis
>
<
XAxis
DataLabelsField
=
"cycle_Date"
BaseUnit
=
"Years"
MajorTickSize
=
"1"
>
<
LabelsAppearance
Visible
=
"true"
RotationAngle
=
"90"
DataFormatString
=
"Year {0:yyyy}"
>
<
TextStyle
Bold
=
"true"
/>
</
LabelsAppearance
>
<
TitleAppearance
Text
=
"Dates"
>
<
TextStyle
Bold
=
"true"
/>
</
TitleAppearance
>
<
MinorGridLines
Visible
=
"false"
></
MinorGridLines
>
<
MajorGridLines
Visible
=
"true"
></
MajorGridLines
>
</
XAxis
>
</
PlotArea
>
<
ChartTitle
>
<
Appearance
>
<
TextStyle
Bold
=
"true"
/>
</
Appearance
>
</
ChartTitle
>
<
Legend
>
<
Appearance
Visible
=
"true"
Position
=
"Bottom"
></
Appearance
>
</
Legend
>
</
telerik:RadHtmlChart
>
</
telerik:RadAjaxPanel
>
Hi
Is it posible to set the styling of the input field of a RadComboBox depending on wether a pre-selected item is enabled og disabled?
Hi,
I have a single series column chart & I want to remove all the column names on the x-axis for space reasons. How can I put those names in a Legend box underneath the chart?
I got a gridview which I created with following code when user clicked one of treview node I have to populate a radgrid for given departmen. I dont know how can I catch treeview click event and without making any postback populate radgrid for clicked departmen. All help will be apreciated, thank you in advance.
//Load Root Nodes... |
private void LoadRootNodes() |
{ |
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Personelcon"].ConnectionString); |
SqlCommand selectCommand = new SqlCommand("SELECT * FROM Department WHERE Reportsto IS NULL", connection); |
SqlDataAdapter adapter = new SqlDataAdapter(selectCommand); |
DataTable data = new DataTable(); |
adapter.Fill(data); |
foreach (DataRow row in data.Rows) |
{ |
RadTreeNode node = new RadTreeNode(); |
node.ImageUrl = "themes/default/entity.gif"; |
node.Text = row["Dname"].ToString(); |
node.Value = row["Departmenid"].ToString(); |
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
RadTreeView1.Nodes.Add(node); |
} |
} |