Hi,
I want to generate another graph on click event of bar for detail view .I saw the demo for the drill down chart but it basically based ajaxmanger and i am working in DNN in user control which is not supported so please tell me any solution thanks in advanced .
thanks
Mukul
Hi!
We have
a version of the Telerik AJAX controls from a few years ago, 2012, and there’s
something that’s come up now that we need to fix. We have a grid that displays
data to the users, and we have it nested within a RadPane on a page that is
divided up with a RadSplitter. Since we have so many different items that we
nest things within, I’ve been using percentages to say what percentage of the
page a control should take up. Our grid uses frozen header columns and we set the
width and height to 100% of the divs that it’s in.
The problem is that the scroll
arrows on the horizontal scroll bar don’t work. You have to drag the bar to get
it to move. I’ve narrowed the problem down to the properties that I can change to
get it to work. If I set the width and height to specific values, like 800px or
300px, the scroll arrows work just fine. However, when I try to set it to a percentage,
like 100%, then the arrow buttons don’t work anymore. I’ve pasted the code
snippet below.
If anyone could tell me what it is
I’m doing wrong and how I can get the width and height to fill the div and
still have the arrows work, I would greatly appreciate it! Thank you so much!
Holly
<
tr
style
=
"height: 75%"
>
<
td
style
=
"height: 85%"
>
<
div
id
=
"Div1"
style
=
"height: 90%; width: 100%"
>
<
Telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
GridLines
=
"Both"
CellSpacing
=
"0"
CellPadding
=
"2"
width
=
"100%"
Height
=
"100%"
EnableViewState
=
"false"
>
<
MasterTableView
TableLayout
=
"Fixed"
CssClass
=
"AutoShrink"
>
<
HeaderStyle
Width
=
"120px"
/>
</
MasterTableView
>
<
ClientSettings
>
<
Scrolling
FrozenColumnsCount
=
"2"
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"True"
>
</
Scrolling
>
<
Resizing
AllowColumnResize
=
"false"
ClipCellContentOnResize
=
"true"
AllowResizeToFit
=
"false"
ResizeGridOnColumnResize
=
"true"
/>
</
ClientSettings
>
</
Telerik:RadGrid
>
</
div
>
<
div
style
=
"font-size: 10pt"
>
This is our grid.</
div
>
</
td
>
</
tr
>
Hello,
I have a radgrid on a modal popup. The first column is a checkbox and that HeaderTemplate is also a checkbox (select all). Everything behaves normally when single clicked. However, when a user accidentally double-clicks any of the checkboxes, the modal closes, which it should not - I actually prefer the postback not even fire. I was able to remedy the issue in Chrome and Firefox buy including the following:
<ClientSettings>
<ClientEvents OnRowDblClick="RowDblClick" />
<ClientEvents OnColumnDblClick ="RowDblClick" />
<ClientSettings>
As well as:
function RowDblClick(sender, eventArgs) {
return false;
}
I am still having the problem with onclick posting back in IE. Has anyone else encountered this?
Hi,
I have some problems to filtering my grid with a FilterTemplate, the client-side event is fired but the method tableView.filter doesn't work properly. The filter return no records.
Here is my .ascx :
<telerik:RadGrid ID="RadGridPoleResult" runat="server" CssClass="gridPoleResult"
AllowPaging="true" AllowSorting="true" PageSize="100"
AllowFilteringByColumn="True" Skin="MetroTouch" ViewStateMode="Disabled" ClientDataSourceID="RadClientDataSource1">
<MasterTableView DataKeyNames="Recid_reporting" ClientDataKeyNames="Recid_reporting" AutoGenerateColumns="False" AllowFilteringByColumn="true" AllowSorting="true">
<PagerStyle Mode="NumericPages" ShowPagerText="false"/>
<Columns>
<telerik:GridBoundColumn HeaderText="ID Reporting" HeaderStyle-HorizontalAlign="Center"
DataField="Recid_reporting" UniqueName="col_ID" Visible="true" ShowFilterIcon="false" FilterControlWidth="60px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Date" HeaderStyle-HorizontalAlign="Center" FilterControlWidth="150px"
DataField="Date" UniqueName="col_Date" DataFormatString="{0:D}" DataType="System.DateTime">
<FilterTemplate>
From
<telerik:RadDatePicker ID="FromOrderDatePicker" runat="server" Width="140px" ClientEvents-OnDateSelected="FromDateSelected"
MinDate="01-01-2010" SelectedDate="01-01-2010"/>
to
<telerik:RadDatePicker ID="ToOrderDatePicker" runat="server" Width="140px" ClientEvents-OnDateSelected="ToDateSelected"
MinDate="01-01-2010" SelectedDate="01-01-2010"/>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function FromDateSelected(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var ToPicker = $find('<%# ((GridItem)Container).FindControl("ToOrderDatePicker").ClientID %>');
var fromDate = FormatSelectedDate(sender);
var toDate = FormatSelectedDate(ToPicker);
tableView.filter("col_Date", fromDate + " " + toDate, "Between");
}
function ToDateSelected(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var FromPicker = $find('<%# ((GridItem)Container).FindControl("FromOrderDatePicker").ClientID %>');
var fromDate = FormatSelectedDate(FromPicker);
var toDate = FormatSelectedDate(sender);
tableView.filter("col_Date", fromDate + " " + toDate, "Between");
}
function FormatSelectedDate(picker) {
var date = picker.get_selectedDate();
var dateInput = picker.get_dateInput();
var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());
return formattedDate;
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Salarié" HeaderStyle-HorizontalAlign="Center"
DataField="Employee" UniqueName="col_Employee" ShowFilterIcon="false" FilterControlWidth="80px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Gamme" HeaderStyle-HorizontalAlign="Center"
DataField="Gamme" UniqueName="col_Gamme" ShowFilterIcon="false" FilterControlWidth="120px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Tache" HeaderStyle-HorizontalAlign="Center"
DataField="Task" UniqueName="col_Task" ShowFilterIcon="false" FilterControlWidth="120px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Quantités déclarées" HeaderStyle-HorizontalAlign="Center"
DataField="DeclaredQty" UniqueName="col_DeclaredQty" ShowFilterIcon="false" FilterControlWidth="50px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Temps déclaré" HeaderStyle-HorizontalAlign="Center"
DataField="DeclaredTime" UniqueName="col_DeclaredTime" ShowFilterIcon="false" FilterControlWidth="50px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Temps passé unitaire" HeaderStyle-HorizontalAlign="Center"
DataField="SpentTimeUnit" UniqueName="col_SpentTimeUnit" ShowFilterIcon="false" FilterControlWidth="50px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Objectif Temps Unitaire" HeaderStyle-HorizontalAlign="Center"
DataField="ObjectiveTimeUnit" UniqueName="col_ObjectiveTimeUnit" ShowFilterIcon="false" FilterControlWidth="50px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="PPJ" HeaderStyle-HorizontalAlign="Center"
DataField="PPJ" UniqueName="col_PPJ" ShowFilterIcon="false" FilterControlWidth="50px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Observation" HeaderStyle-HorizontalAlign="Center"
DataField="Observation" UniqueName="col_Observation" ShowFilterIcon="false" FilterControlWidth="60px" FilterDelay="200">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Cadence" HeaderStyle-HorizontalAlign="Center"
DataField="Cadence" UniqueName="col_Cadence" Display="false" ShowFilterIcon="false" FilterControlWidth="120px" FilterDelay="200">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<ClientEvents OnRowDataBound="OnRowDataBound" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
<DataSource>
<WebServiceDataSourceSettings>
<Select Url="/DesktopModules/Itancia SuiviProd/WebServices/API/Reporting/GetAllPoleReporting" RequestType="Get" />
</WebServiceDataSourceSettings>
</DataSource>
<Schema>
<Model ID="Recid_reporting">
<telerik:ClientDataSourceModelField FieldName="Recid_reporting" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="Date" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="Employee" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="Gamme" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="Task" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="DeclaredQty" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="Cadence" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="DeclaredTime" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="PPJ" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="Observation" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="ObjectiveTimeUnit" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="SpentTimeUnit" DataType="String" />
</Model>
</Schema>
</telerik:RadClientDataSource>
And my .js :
function OnRowDataBound(sender, args) {
var dataItem = args.get_dataItem();
if (dataItem.PPJ > 95) {
args.get_item().get_cell("col_PPJ").style.background = "#D2FFD2";
}
else {
args.get_item().get_cell("col_PPJ").style.background = "#FFD7FF";
}
if (dataItem.PPJ <= 0) {
args.get_item().get_cell("col_PPJ").style.background = "LightGray";
}
args.get_item().get_cell("col_Date").innerHTML = moment(dataItem.Date).format("DD/MM/YYYY").toString();
}
For information, my version of Telerik.Web.UI is 2014.3.1209.40 and the used date format is dd/mm/yyyy.
Do you have an idea about this problem ?
Thank you,
Clément
Dear All,
i followed the link http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/automatic-crud-operations/defaultcs.aspx and was able to see the data data in the RadGrid. But i was unable to edit or delete and when i tried to insert a row i wasn't able to see the text box where you can enter the data. i can only see a tick and a cross button . when i click on the tick button an empty row will be added to the table.
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head id="Head1" runat="server">
<title>Telerik ASP.NET Example</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadFormDecorator runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />
<div id="demo" class="demo-container no-bg">
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EntityDataSource1"
AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
AllowAutomaticDeletes="True" AllowSorting="True" OnItemCreated="RadGrid1_ItemCreated"
OnItemInserted="RadGrid1_ItemInserted" OnPreRender="RadGrid1_PreRender"
OnInsertCommand="RadGrid1_InsertCommand" GroupPanelPosition="Top"
ResolvedRenderMode="Classic">
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView DataSourceID="EntityDataSource1"
AutoGenerateColumns="False" CommandItemDisplay="Top">
<Columns>
<telerik:GridBoundColumn DataField="Self_development"
HeaderText="Self_development" SortExpression="Self_development"
UniqueName="Self_development"
FilterControlAltText="Filter Self_development column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Technical_Development"
HeaderText="Technical_Development" SortExpression="Technical_Development"
UniqueName="Technical_Development"
FilterControlAltText="Filter Technical_Development column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Project_Management"
HeaderText="Project_Management" SortExpression="Project_Management"
UniqueName="Project_Management"
FilterControlAltText="Filter Project_Management column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Client_Relationship"
HeaderText="Client_Relationship" SortExpression="Client_Relationship"
UniqueName="Client_Relationship"
FilterControlAltText="Filter Client_Relationship column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Safety" HeaderText="Safety" SortExpression="Safety"
UniqueName="Safety" FilterControlAltText="Filter Safety column"
ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Leadership_Development"
FilterControlAltText="Filter Leadership_Development column"
HeaderText="Leadership_Development" ReadOnly="True"
SortExpression="Leadership_Development" UniqueName="Leadership_Development"></telerik:GridBoundColumn><telerik:GridBoundColumn
DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column"
HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID"></telerik:GridBoundColumn></Columns>
<EditFormSettings>
<EditColumn ButtonType="ImageButton" />
<EditColumn ButtonType="ImageButton"></EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
</div>
<%--<asp:EntityDataSource ID="EntityDataSourceCustomers" runat="server" ConnectionString="name=NorthwindReadWriteEntities"
DefaultContainerName="NorthwindReadWriteEntities" EntitySetName="Customers" OrderBy="it.[ContactName]"
EntityTypeFilter="Customer" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True">
</asp:EntityDataSource>--%>
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=LMSDBEntities3" DefaultContainerName="LMSDBEntities3"
EntitySetName="Course_mainPage"
OrderBy="it.[Self_development]"
EnableDelete="True" EnableInsert="True" EnableUpdate="True" >
</asp:EntityDataSource>
<%-- Select="it.[Self_development], it.[Technical_Development], it.[Project_Management], it.[Client_Relationship], it.[Safety], it.[Leadership_Development], it.[ID]" --%>
</form>
</body>
</html>
C#
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
if (!(e.Item is GridEditFormInsertItem))
{
GridEditableItem item = e.Item as GridEditableItem;
GridEditManager manager = item.EditManager;
GridTextBoxColumnEditor editor = manager.GetColumnEditor("ID") as GridTextBoxColumnEditor;
editor.TextBoxControl.Enabled = false;
}
}
}
protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
{
if (e.Exception != null)
{
e.ExceptionHandled = true;
SetMessage("Record cannot be inserted. Reason: " + e.Exception.Message);
}
else
{
SetMessage("New Record is inserted!");
}
}
private void DisplayMessage(string text)
{
RadGrid1.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
}
private void SetMessage(string message)
{
gridMessage = message;
}
private string gridMessage = null;
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(gridMessage))
{
DisplayMessage(gridMessage);
}
}
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
if (e.Item is GridEditableItem)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
//here editedItem.SavedOldValues will be the dictionary which holds the
//predefined values
//Prepare new dictionary object
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
//the newValues instance is the new collection of key -> value pairs
//with the updated ny the user data
}
}
}
please advice
Regards
Kannan
I am using RadGrid and showing 2 level hierarchial data master and detail.
I want to export just the detail table of a single master row to Excel
Is it possible to do it.
Note: I can export the complete Grid to Excel and it works.
Thanks,
Vinod
i was following the link http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/automatic-crud-operations/defaultcs.aspx. and managed to see the records from the db but was unable to edit or delete them. and when i was trying to insert i wasnt able to see the textbox where you enter the records and only a tick box button and x button is available.
please see the code
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head id="Head1" runat="server">
<title>Telerik ASP.NET Example</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadFormDecorator runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />
<div id="demo" class="demo-container no-bg">
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EntityDataSource1"
AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
AllowAutomaticDeletes="True" AllowSorting="True" OnItemCreated="RadGrid1_ItemCreated"
OnItemInserted="RadGrid1_ItemInserted" OnPreRender="RadGrid1_PreRender"
OnInsertCommand="RadGrid1_InsertCommand" GroupPanelPosition="Top"
ResolvedRenderMode="Classic">
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView DataSourceID="EntityDataSource1"
AutoGenerateColumns="False" CommandItemDisplay="Top">
<Columns>
<telerik:GridBoundColumn DataField="Self_development"
HeaderText="Self_development" SortExpression="Self_development"
UniqueName="Self_development"
FilterControlAltText="Filter Self_development column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Technical_Development"
HeaderText="Technical_Development" SortExpression="Technical_Development"
UniqueName="Technical_Development"
FilterControlAltText="Filter Technical_Development column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Project_Management"
HeaderText="Project_Management" SortExpression="Project_Management"
UniqueName="Project_Management"
FilterControlAltText="Filter Project_Management column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Client_Relationship"
HeaderText="Client_Relationship" SortExpression="Client_Relationship"
UniqueName="Client_Relationship"
FilterControlAltText="Filter Client_Relationship column" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Safety" HeaderText="Safety" SortExpression="Safety"
UniqueName="Safety" FilterControlAltText="Filter Safety column"
ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Leadership_Development"
FilterControlAltText="Filter Leadership_Development column"
HeaderText="Leadership_Development" ReadOnly="True"
SortExpression="Leadership_Development" UniqueName="Leadership_Development"></telerik:GridBoundColumn><telerik:GridBoundColumn
DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column"
HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID"></telerik:GridBoundColumn></Columns>
<EditFormSettings>
<EditColumn ButtonType="ImageButton" />
<EditColumn ButtonType="ImageButton"></EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
</div>
<%--<asp:EntityDataSource ID="EntityDataSourceCustomers" runat="server" ConnectionString="name=NorthwindReadWriteEntities"
DefaultContainerName="NorthwindReadWriteEntities" EntitySetName="Customers" OrderBy="it.[ContactName]"
EntityTypeFilter="Customer" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True">
</asp:EntityDataSource>--%>
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=LMSDBEntities3" DefaultContainerName="LMSDBEntities3"
EntitySetName="Course_mainPage"
OrderBy="it.[Self_development]"
EnableDelete="True" EnableInsert="True" EnableUpdate="True" >
</asp:EntityDataSource>
<%-- Select="it.[Self_development], it.[Technical_Development], it.[Project_Management], it.[Client_Relationship], it.[Safety], it.[Leadership_Development], it.[ID]" --%>
</form>
</body>
</html>
c#
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
if (!(e.Item is GridEditFormInsertItem))
{
GridEditableItem item = e.Item as GridEditableItem;
GridEditManager manager = item.EditManager;
GridTextBoxColumnEditor editor = manager.GetColumnEditor("ID") as GridTextBoxColumnEditor;
editor.TextBoxControl.Enabled = false;
}
}
}
protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
{
if (e.Exception != null)
{
e.ExceptionHandled = true;
SetMessage("Record cannot be inserted. Reason: " + e.Exception.Message);
}
else
{
SetMessage("New Record is inserted!");
}
}
private void DisplayMessage(string text)
{
RadGrid1.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
}
private void SetMessage(string message)
{
gridMessage = message;
}
private string gridMessage = null;
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(gridMessage))
{
DisplayMessage(gridMessage);
}
}
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
if (e.Item is GridEditableItem)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
//here editedItem.SavedOldValues will be the dictionary which holds the
//predefined values
//Prepare new dictionary object
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
//the newValues instance is the new collection of key -> value pairs
//with the updated ny the user data
}
}
}
I'm trying to find a DropDownList in my RadGrid using FindControl() method. But it's always returning null so it cannot find the DropDownList. I have the following HTML code:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowFilteringByColumn
=
"True"
DataSourceID
=
"SqlDataSource1"
GroupPanelPosition
=
"Top"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
CommandItemDisplay
=
"Top"
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"myName"
HeaderText
=
"header text"
>
<
EditItemTemplate
>
<
asp:DropDownList
ID
=
"myDropDown"
DataTextField
=
"TextFieldValue"
DataValueField
=
"ValueFieldValue"
runat
=
"server"
/>
</
EditItemTemplate
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
And I'm trying to find "myDropDown" using this C# code:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DropDownList list = (DropDownList)item.FindControl(
"myDropDown"
);
}
}
But it cannot find the DropDownList. Can you tell me what I'm doing wrong?
Any help appreciated.
Regards,
Danilo
See Telerik column chart demo here:
http://demos.telerik.com/aspnet-ajax/htmlchart/examples/charttypes/columnchart/defaultcs.aspx
Notice the labels above each column, such as "25000 sales". Now notice in the declarative code how this label is set:
<LabelsAppearance DataFormatString="{0} sales" Position="OutsideEnd"></LabelsAppearance>
I either need to set DataFormatString programmatically, or (better yet) I need to set it to the value of a column in my dataset from sql server. This column's data is not on the chart currently because I ONLY want that column's data used at the label at the top of each column. I can't figure out how to do either. How is it done?