or
I am using GridImageColumn for displaying an icon if the value in a table column (HasRead) which is bound to the RadGrid Control is false.
Here is the aspx code..
<
Telerik:RadGrid
ID
=
"TelerikThread"
Width
=
"97%"
AllowSorting
=
"True"
PageSize
=
"15"
OnItemDataBound
=
"TelerikThread_ItemDataBound"
AllowPaging
=
"True"
AllowMultiRowSelection
=
"True"
runat
=
"server"
Gridlines
=
"None"
>
<
MasterTableView
Width
=
"100%"
Summary
=
"RadGrid table"
AutoGenerateColumns
=
"false"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
Columns
>
<
Telerik:GridImageColumn
UniqueName
=
"GridImageColumn"
SortExpression
=
"HasRead"
HeaderText
=
"Unread"
DataImageUrlFields
=
"HasRead"
>
</
Telerik:GridImageColumn
>
protected void TelerikThread_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
TableCell flag = (TableCell)item["HasRead"];
if (flag.Text == "false")
{
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)item["GridImageColumn"].Controls[0];
img.ImageUrl = "./web/Themes/default/images/post_status_new_ln.gif";//set image url
}
else
{
TableCell cell = (TableCell)item["GridImageColumn"];
cell.Text = " ";//clears image column
}
}
}
GridDataItem item = (GridDataItem)e.Item;
"Cannot cast e.item to GridDataItem"Hi,
I have a Self Referencing Hierarchy grid in which i have made rows editable on double click client event. Required grid properties for disabling multiple rows edit at the same time have been set as follows-
AllowMultiRowSelection="false" AllowMultiRowEdit="false"
Still I am able to select and Edit multiple rows at a time.
Client Settings are as follows-
<
ClientSettings
AllowExpandCollapse
=
"true"
>
<
ClientEvents
OnRowDblClick
=
"RowdblClick"
/>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
Javascript used-
<
script
language
=
"javascript"
type
=
"text/javascript"
>
function RowdblClick(sender, eventArgs)
{
RowEdit(sender, eventArgs);
}
function RowEdit(sender, eventArgs)
{
//debugger;
var editedRow = eventArgs.get_item();
editedRow.id= eventArgs.get_id();
$find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow);
}
</
script
>
<
telerik:RadChart
ID
=
"radchartPCSUserItems"
Width
=
"910"
EnableViewState
=
"False"
runat
=
"server"
Skin
=
"Web20"
SeriesOrientation
=
"Horizontal"
Legend-Visible
=
"false"
AutoLayout
=
"false"
>
<
Series
>
<
telerik:ChartSeries
Type
=
"Gantt"
Name
=
"Series 1"
>
</
telerik:ChartSeries
>
</
Series
>
<
PlotArea
Appearance-Dimensions-Width
=
"700"
>
<
YAxis
IsZeroBased
=
"False"
AutoScale
=
"False"
>
<
Appearance
MinorGridLines-Visible
=
"false"
>
<
LabelAppearance
RotationAngle
=
"60"
Position-AlignedPosition
=
"top"
></
LabelAppearance
>
</
Appearance
>
</
YAxis
>
<
YAxis2
IsZeroBased
=
"False"
AutoScale
=
"False"
>
</
YAxis2
>
<
XAxis
AutoScale
=
"False"
Step
=
"10"
>
<
AxisLabel
TextBlock-Text
=
"Item"
></
AxisLabel
>
<
Appearance
MajorGridLines-Visible
=
"true"
>
<
LabelAppearance
Position-AlignedPosition
=
"left"
></
LabelAppearance
>
</
Appearance
>
</
XAxis
>
<
Appearance
Dimensions-Margins
=
"2px, 3px, 5px, 25%"
Dimensions-Paddings
=
"0%, 0%, 5px, 0%"
></
Appearance
>
</
PlotArea
>
<
Legend
Visible
=
"False"
></
Legend
>
<
Appearance
Border-Visible
=
"False"
></
Appearance
>
<
ChartTitle
Visible
=
"False"
></
ChartTitle
>
</
telerik:RadChart
>
My chart
private
void
BindGanttChart(PCSUserItemCollection pcsUserItemCol)
{
DateTime dtMaxDate = pcsUserItemCol[0].DueDate;
DateTime dtMinDate = pcsUserItemCol[0].StartDate;
foreach
(PCSUserItem useritem
in
pcsUserItemCol)
{
if
(useritem.DueDate > dtMaxDate)
// get the max date
{
dtMaxDate = useritem.DueDate;
}
if
(dtMinDate > useritem.StartDate)
// get the min date
{
dtMinDate = useritem.StartDate;
}
// Create the Chart Data Points
Telerik.Charting.ChartSeriesItem chartItem =
new
Telerik.Charting.ChartSeriesItem();
chartItem.YValue = useritem.StartDate.ToOADate();
chartItem.YValue2 = useritem.DueDate.ToOADate();
chartItem.Label.TextBlock.Text = useritem.DueDate.ToShortDateString();
chartItem.Label.TextBlock.Appearance.TextProperties.Font =
new
System.Drawing.Font(
"Arial"
, 7, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
chartItem.Name = useritem.ID.ToString();
radchartPCSUserItems.Series[0].Items.Add(chartItem);
// Set the X-Axis label's text
Telerik.Charting.ChartAxisItem chartAxisItem =
new
Telerik.Charting.ChartAxisItem();
chartAxisItem.TextBlock.Text = useritem.Title;
radchartPCSUserItems.PlotArea.XAxis.Items.Add(chartAxisItem);
}
// Define the Chart MinVal, MaxVal & Step (Scale)
if
(dtMaxDate != DateTime.MinValue)
{
radchartPCSUserItems.PlotArea.YAxis.Step = 30;
radchartPCSUserItems.PlotArea.YAxis.MinValue = dtMinDate.AddMonths(-1).ToOADate();
radchartPCSUserItems.PlotArea.YAxis.MaxValue = dtMaxDate.AddDays(30).ToOADate();
radchartPCSUserItems.PlotArea.YAxis2.Step = 30;
radchartPCSUserItems.PlotArea.YAxis2.MinValue = dtMinDate.AddMonths(-1).ToOADate();
radchartPCSUserItems.PlotArea.YAxis2.MaxValue = dtMaxDate.AddDays(30).ToOADate();
}
radchartPCSUserItems.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
radchartPCSUserItems.DataBind();
}