Hi,
I have a rating column inside a ragrid, which usually works fine, however I am encountering an error when I add new items to it for the first time.
If items are loaded from the database, then they appear correctly, however if I update the previously empty data source with a new item, the rating column will display hyperlinks for 1,2,3,4,5, rather than the star images that are usually present. Please see the attached screenshots for more details.
I haven't come across this problem anywhere else on the forum, so any help would be appreciated.
I have a rating column inside a ragrid, which usually works fine, however I am encountering an error when I add new items to it for the first time.
If items are loaded from the database, then they appear correctly, however if I update the previously empty data source with a new item, the rating column will display hyperlinks for 1,2,3,4,5, rather than the star images that are usually present. Please see the attached screenshots for more details.
I haven't come across this problem anywhere else on the forum, so any help would be appreciated.
8 Answers, 1 is accepted
0
Hi Mathew,
Could you paste your complete aspx and code-behind as this problem is not an expected one.
Greetings, Tsvetoslav
the Telerik team
Could you paste your complete aspx and code-behind as this problem is not an expected one.
Greetings, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Dean
Top achievements
Rank 1
answered on 14 Oct 2011, 06:32 PM
I’m experiencing a very similar issue, and I’m wondering if it’s related. If not do you have any tricks to get the rating control to render the first time in IE.
0
Hi Dean,
Your code will be appreciated too.
Greetings, Tsvetoslav
the Telerik team
Your code will be appreciated too.
Greetings, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Dean
Top achievements
Rank 1
answered on 17 Oct 2011, 02:09 PM
The Grid
The JavaScript
The Code Behind
<
telerik:RadGrid
ID
=
"RadGridEmployeeSearchResults"
runat
=
"server"
AllowMultiRowSelection
=
"false"
Width
=
"1140px"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
OnItemDataBound
=
"RadGridEmployeeSearchResults_ItemDataBound"
AllowPaging
=
"True"
OnNeedDataSource
=
"RadGridEmployeeSearchResults_NeedDataSource"
ExportSettings-ExportOnlyData
=
"true"
ExportSettings-IgnorePaging
=
"true"
>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
MasterTableView
DataKeyNames
=
"emEmployeeEntity_Id"
CommandItemDisplay
=
"Top"
EnableNoRecordsTemplate
=
"true"
CommandItemSettings-ShowExportToCsvButton
=
"true"
CommandItemSettings-ShowExportToExcelButton
=
"true"
CommandItemSettings-ShowExportToPdfButton
=
"false"
CommandItemSettings-ShowExportToWordButton
=
"false"
PageSize
=
"20"
GroupLoadMode
=
"Client"
AllowAutomaticInserts
=
"false"
HierarchyDefaultExpanded
=
"true"
ClientDataKeyNames
=
"emEmployeeEntity_Id"
>
<
CommandItemSettings
ShowRefreshButton
=
"true"
ShowAddNewRecordButton
=
"false"
/>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"select"
ItemStyle-VerticalAlign
=
"Top"
ItemStyle-HorizontalAlign
=
"Left"
HeaderStyle-Width
=
"36px"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"image"
AllowFiltering
=
"false"
ItemStyle-VerticalAlign
=
"Top"
HeaderStyle-Width
=
"35px"
ItemStyle-HorizontalAlign
=
"Left"
>
<
ItemTemplate
>
<
asp:Image
ID
=
"menuIcon"
runat
=
"server"
ImageUrl
=
"../../images/icon_24x24_process.png"
/>
<
telerik:RadToolTip
ID
=
"RadToolTip1"
runat
=
"server"
TargetControlID
=
"menuIcon"
HideEvent
=
"LeaveTargetAndToolTip"
Position
=
"MiddleRight"
Width
=
"200px"
SkinID
=
"RadToolTipDefault"
AutoCloseDelay
=
"10000"
>
<
div
style
=
"margin: 15px;"
>
<
div
style
=
"background-color: #1FA9FF; width: 100%; text-transform: uppercase; color: White;"
>
<
div
style
=
"padding: 5px;"
>
Solo Actions</
div
>
</
div
>
<
div
style
=
"margin-left: 2px;"
>
<
p
style
=
"line-height: 20px;"
>
<
asp:LinkButton
ID
=
"LinkButtonCredentials"
runat
=
"server"
CommandName
=
"Credentials"
CausesValidation
=
"false"
CommandArgument='<%# Eval("emEmployeeEntity_Id") %>'>Mini Credentials</
asp:LinkButton
>
<
br
>
<
asp:LinkButton
ID
=
"LinkButtonSchedule"
runat
=
"server"
CommandName
=
"Schedule"
CausesValidation
=
"false"
CommandArgument='<%# Eval("emEmployeeEntity_Id") %>'>View Schedule</
asp:LinkButton
>
<
br
>
<%--<
asp:LinkButton
ID
=
"LinkButtonAddSchedule"
runat
=
"server"
CommandName
=
"Tag"
CausesValidation
=
"false"
CommandArgument='<%# Eval("emEmployeeEntity_Id") %>'>Add Schedule Entry</
asp:LinkButton
>
<
br
>--%>
<
asp:LinkButton
ID
=
"LinkButtonNote"
runat
=
"server"
CommandName
=
"Note"
CausesValidation
=
"false"
CommandArgument='<%# Eval("emEmployeeEntity_Id") %>'>Add Note</
asp:LinkButton
>
<
br
>
<
asp:LinkButton
ID
=
"LinkButtonEmail"
runat
=
"server"
CommandName
=
"Email"
CausesValidation
=
"false"
CommandArgument='<%# Eval("emEmployeeEntity_Id") %>'>Send Email</
asp:LinkButton
>
<
br
>
<
asp:LinkButton
ID
=
"LinkButtonBadge"
runat
=
"server"
CommandName
=
"Badge"
CausesValidation
=
"false"
CommandArgument='<%# Eval("emEmployeeEntity_Id") %>'>Show Badge</
asp:LinkButton
>
</
p
>
</
div
>
</
div
>
</
telerik:RadToolTip
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Name"
UniqueName
=
"last_nm"
DataField
=
"emEmployee.ExtFormattedFullName"
ItemStyle-Font-Size
=
"18px"
ItemStyle-VerticalAlign
=
"Top"
SortExpression
=
"emEmployee.ExtFormattedFullName"
>
<
ItemTemplate
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LinkButtonDetails"
OnClick
=
"LinkButtonDetails_Click"
CausesValidation
=
"False"
/>
</
ItemTemplate
>
<
HeaderStyle
Width
=
"200px"
/>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"emStatusType.status_nm"
HeaderText
=
"Status"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"Status"
>
<
HeaderStyle
Width
=
"200px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtPrimaryEmailAddress"
HeaderText
=
"Email"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"Email"
>
<
HeaderStyle
Width
=
"225px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtSpecialtyTypes"
HeaderText
=
"Specialty"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"Specialty"
>
<
HeaderStyle
Width
=
"150px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtPositionTypes"
HeaderText
=
"Position Types"
UniqueName
=
"position"
ItemStyle-VerticalAlign
=
"Top"
>
<
HeaderStyle
Width
=
"75px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"bhEntity.Entity_Nm"
HeaderText
=
"Location"
UniqueName
=
"Location"
ItemStyle-VerticalAlign
=
"Top"
>
<
HeaderStyle
Width
=
"175px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtPrimaryPhoneAndType"
HeaderText
=
"Phone & Type"
UniqueName
=
"Phone"
ItemStyle-VerticalAlign
=
"Top"
>
<
HeaderStyle
Width
=
"150px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtLOB"
HeaderText
=
"Line of Business"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"LOB"
>
<
HeaderStyle
Width
=
"200px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtAvailability"
HeaderText
=
"Availability"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"Availability"
>
<
HeaderStyle
Width
=
"200px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtLiveIn"
HeaderText
=
"Live-In Availability"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"LiveInAvailability"
>
<
HeaderStyle
Width
=
"75px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.minimum_hourly_wage"
HeaderText
=
"Minimum Payrate"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"MinimumPayrate"
DataFormatString
=
"{0:C2}"
>
<
HeaderStyle
Width
=
"75px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtLanguageTypes"
HeaderText
=
"Languages Spoken"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"LanguagesSpoken"
>
<
HeaderStyle
Width
=
"150px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"hireDate"
HeaderText
=
"Hire Date"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"HireDate"
DataFormatString
=
"{0:MM/dd/yyyy}"
>
<
HeaderStyle
Width
=
"100px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.coTransportationType.transportationTypeName"
HeaderText
=
"Transportation Type"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"TransportationType"
>
<
HeaderStyle
Width
=
"100px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridRatingColumn
DataField
=
"ExtPerformanceStarRating"
HeaderText
=
"Customer Rating"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"CustomerRating"
>
<
HeaderStyle
Width
=
"125px"
/>
</
telerik:GridRatingColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.travel_distance"
HeaderText
=
"Distance Will Travel"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"DistanceWillTravel"
>
<
HeaderStyle
Width
=
"75px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtAddress"
SortExpression
=
"emEmployee.coAddress.Address_Line1"
HeaderText
=
"Home Address"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"HomeAddress"
>
<
HeaderStyle
Width
=
"200px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtCity"
HeaderText
=
"Home Address City"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"HomeAddressCity"
>
<
HeaderStyle
Width
=
"150px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtState"
HeaderText
=
"Home Address State"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"HomeAddressState"
>
<
headerstyle
width
=
"100px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"emEmployee.ExtPostalCode"
HeaderText
=
"Home Address Postal Code"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"HomeAddressPostalCode"
HeaderStyle-Wrap
=
"true"
>
<
HeaderStyle
Width
=
"100px"
Wrap
=
"true"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ExtPerformanceLastAppraisalDate"
HeaderText
=
"Date of Last Appraisal"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"LastAppraisalDate"
>
<
headerstyle
width
=
"100px"
/>
</
telerik:GridBoundColumn
>
<%--<
telerik:GridBoundColumn
DataField
=
""
HeaderText
=
"Performance Evaluation Rating"
ItemStyle-VerticalAlign
=
"Top"
UniqueName
=
"PerformanceEvaluationRating"
/>--%>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
Scrolling-UseStaticHeaders
=
"True"
Scrolling-AllowScroll
=
"True"
Resizing-ClipCellContentOnResize
=
"False"
>
<
Selecting
AllowRowSelect
=
"true"
UseClientSelectColumnOnly
=
"true"
/>
<
ClientEvents
OnRowSelected
=
"HideShowGroupActionButton"
OnGridCreated
=
"GridCreated"
OnRowDeselected
=
"HideShowGroupActionButton"
></
ClientEvents
>
<
Scrolling
UseStaticHeaders
=
"True"
></
Scrolling
>
<
Resizing
AllowColumnResize
=
"true"
ResizeGridOnColumnResize
=
"false"
/>
</
ClientSettings
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
The JavaScript
function
GridCreated() {
HideShowGroupActionButton();
}
function
HideShowGroupActionButton() {
var
grid = $find(
"<%=RadGridEmployeeSearchResults.ClientID %>"
);
var
table = document.getElementById(
"<%=TableMegaDropdown.ClientID %>"
);
var
gridSelectedItems = grid.get_masterTableView().get_selectedItems();
if
(gridSelectedItems.length >= 1) {
table.style.display =
"block"
;
}
else
{
table.style.display =
"none"
;
}
}
The Code Behind
#region RadGrid Events
protected void RadGridEmployeeSearchResults_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
BindData();
}
private void BindData()
{
if (!Page.IsPostBack)
{
RadGridEmployeeSearchResults.DataSource = new object[] { };
}
else
{
Dictionary<
string
, string> predicates = new Dictionary<
string
, string>();
if (RadTextBoxName.Text != string.Empty)
{
string temp = RadTextBoxName.Text;
predicates.Add("name", RadTextBoxName.Text);
}
if (RadRatingPerformance.SelectedValue != "-1")
predicates.Add("star_rating", RadRatingPerformance.SelectedValue);
if (RadComboBoxLocation.SelectedValue != "-1")
predicates.Add("entity_id", RadComboBoxLocation.SelectedValue);
//Advanced Search
if (RadComboBoxLOBU.SelectedValue != "-1")
predicates.Add("line_of_business_category_id", RadComboBoxLOBU.SelectedValue);
if (RadComboBoxSupervisor.SelectedValue != "-1")
predicates.Add("supervisor_id", RadComboBoxSupervisor.SelectedValue);
if (RadComboBoxLanguage.SelectedValue != "-1")
predicates.Add("Language_ID", RadComboBoxLanguage.SelectedValue);
if (RadComboBoxSpecialty.SelectedValue != "-1")
predicates.Add("specialty_type_id", RadComboBoxSpecialty.SelectedValue);
if (RadTextBoxCity.Text != string.Empty)
predicates.Add("City", RadTextBoxCity.Text);
if (RadTextBoxPostalCode.Text != string.Empty)
predicates.Add("Zip", RadTextBoxPostalCode.Text);
if (RadComboBoxPosition.SelectedValue != "-1")
predicates.Add("position", RadComboBoxPosition.SelectedValue);
if (RadComboBoxCredentials.SelectedValue != "-1")
predicates.Add("credentials", RadComboBoxCredentials.SelectedValue);
if (RadComboBoxStatus.SelectedValue != "-1")
predicates.Add("status", RadComboBoxStatus.SelectedValue);
if (RadTextBoxTags.Text != string.Empty)
predicates.Add("tags", RadTextBoxTags.Text);
List<
emEmployeeEntity
> _entities = new List<
emEmployeeEntity
>();
_entities = _bhEmployeeBO.EmployeeSearchResults(predicates);
RadGridEmployeeSearchResults.DataSource = _entities.ToList();
}
}
protected void RadGridEmployeeSearchResults_ItemDataBound(object sender, GridItemEventArgs e)
{
//Main Grid
if (e.Item is GridDataItem && e.Item.OwnerTableView.Name != "Details")
{
GridDataItem item = e.Item as GridDataItem;
_employeeEntity = e.Item.DataItem as emEmployeeEntity;
// Solo Menu Items
LinkButton LinkButtonCredentials = e.Item.FindControl("LinkButtonCredentials") as LinkButton;
LinkButton LinkButtonSchedule = e.Item.FindControl("LinkButtonSchedule") as LinkButton;
//LinkButton LinkButtonAddSchedule = e.Item.FindControl("LinkButtonAddSchedule") as LinkButton;
LinkButton LinkButtonNote = e.Item.FindControl("LinkButtonNote") as LinkButton;
LinkButton LinkButtonEmail = e.Item.FindControl("LinkButtonEmail") as LinkButton;
LinkButton LinkButtonBadge = e.Item.FindControl("LinkButtonBadge") as LinkButton;
try
{
RadToolTip RadToolTip1 = e.Item.FindControl("RadToolTip1") as RadToolTip;
LinkButtonCredentials.OnClientClick = String.Format("CloseRadToolTip('" + RadToolTip1.ClientID + "'); return ShowSoloForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["emEmployeeEntity_Id"], "Cred");
LinkButtonSchedule.OnClientClick = String.Format("CloseRadToolTip('" + RadToolTip1.ClientID + "'); return ShowSoloForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["emEmployeeEntity_Id"], "Sched");
//LinkButtonAddSchedule.OnClientClick = String.Format("CloseRadToolTip('" + RadToolTip1.ClientID + "'); return ShowSoloForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["emEmployeeEntity_Id"], "SchedAdd");
LinkButtonNote.OnClientClick = String.Format("CloseRadToolTip('" + RadToolTip1.ClientID + "'); return ShowSoloForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["emEmployeeEntity_Id"], "Note");
LinkButtonEmail.OnClientClick = String.Format("CloseRadToolTip('" + RadToolTip1.ClientID + "'); return ShowSoloForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["emEmployeeEntity_Id"], "Email");
LinkButtonBadge.OnClientClick = String.Format("CloseRadToolTip('" + RadToolTip1.ClientID + "'); return ShowSoloForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["emEmployeeEntity_Id"], "Badge");
}
catch { }
//Employee Name LinkButton
LinkButton btn = (LinkButton)item["last_nm"].FindControl("LinkButtonDetails");
btn.Text = _bhEmployeeBO.GetEmployeeName(_employeeEntity.emEmployee);
btn.Attributes.Add("id", _employeeEntity.emEmployeeEntity_id.ToString());
}
}
#endregion
0

Mathew
Top achievements
Rank 1
answered on 17 Oct 2011, 03:20 PM
Hi,
After some further investiagtion, the grid works correctly when I place it on a test page, however when it is included in one of our item pages, I still get the error in the
It's quite difficult for me to post my code in it's entirity because it's inheriting from several base classes, but I'll try and provide all of the relevant parts.
EmbeddedGridControlBase
AbsStandardsGrid : EmbeddedGridControlBase
After some further investiagtion, the grid works correctly when I place it on a test page, however when it is included in one of our item pages, I still get the error in the
It's quite difficult for me to post my code in it's entirity because it's inheriting from several base classes, but I'll try and provide all of the relevant parts.
EmbeddedGridControlBase
private
void
InitGrid()
{
if
(m_Grid !=
null
)
return
;
//already init
m_Grid =
new
RadGrid();
m_Grid.Width = Unit.Percentage(100);
m_Grid.Init +=
new
EventHandler(m_Grid_Init);
m_Grid.NeedDataSource +=
new
GridNeedDataSourceEventHandler(m_Grid_NeedDataSource);
m_Grid.UpdateCommand +=
new
GridCommandEventHandler(m_Grid_UpdateCommand);
m_Grid.DeleteCommand +=
new
GridCommandEventHandler(m_Grid_DeleteCommand);
m_Grid.InsertCommand +=
new
GridCommandEventHandler(m_Grid_InsertCommand);
m_Grid.EditCommand +=
new
GridCommandEventHandler(m_Grid_EditCommand);
m_Grid.CancelCommand +=
new
GridCommandEventHandler(m_Grid_CancelCommand);
m_Grid.ItemCommand +=
new
GridCommandEventHandler(m_Grid_ItemCommand);
m_Grid.ItemDataBound +=
new
GridItemEventHandler(m_Grid_ItemDataBound);
}
private
void
m_Grid_Init(
object
sender, EventArgs e)
{
// Just sets up edit, open and delete commands
}
private
void
m_Grid_NeedDataSource(
object
source, GridNeedDataSourceEventArgs e)
{
object
dataSource =
this
.GetGridDataSource();
if
(dataSource ==
null
)
return
;
try
{
UIControlHelper.ValidateDataSet(dataSource);
this
.Grid.DataSource = dataSource;
}
catch
(Exception ex)
{
this
.Grid.DataSource =
null
;
}
}
AbsStandardsGrid : EmbeddedGridControlBase
protected
override
void
ConfigureGridGrouping(
ref
RadGrid target)
{
GridGroupByExpression expression =
new
GridGroupByExpression();
GridGroupByField field =
new
GridGroupByField();
field =
new
GridGroupByField();
field.HeaderText =
" "
;
field.HeaderValueSeparator =
""
;
field.FieldName =
"StandardClauseName"
;
field.FormatString =
"<strong>{0}</strong>"
;
expression.SelectFields.Add(field);
expression.GroupByFields.Add(field);
target.MasterTableView.GroupByExpressions.Add(expression);
GridSortExpression sortExpr =
new
GridSortExpression();
sortExpr.FieldName =
"Standard.Number"
;
sortExpr.SortOrder = GridSortOrder.Ascending;
//Add sort expression, which will sort against first column
target.MasterTableView.SortExpressions.AddSortExpression(sortExpr);
}
protected
override
void
ConfigureDataKeys(
ref
RadGrid grid)
{
grid.MasterTableView.DataKeyNames =
new
string
[] {
"Standard.Id"
};
}
protected
override
void
ConfigureGridColumns(
ref
Telerik.Web.UI.RadGrid grid)
{
base
.ConfigureGridColumns(
ref
grid);
grid.AutoGenerateColumns =
false
;
grid.Columns.Add(
new
GridBoundColumn() { HeaderText =
"Number"
, DataField =
"Standard.Number"
, AllowSorting =
true
, ReadOnly =
true
});
grid.Columns.Add(
new
GridBoundColumn() { HeaderText =
"Standard Name"
, DataField =
"Standard.Text"
, AllowSorting=
true
, ReadOnly =
true
});
grid.Columns.Add(
new
GridRatingColumn() { HeaderText =
"Percentage"
, UniqueName =
"Rating"
, DataField =
"Rating"
, Precision = RatingPrecision.Half, ItemCount = 5 });
grid.UpdateCommand +=
new
GridCommandEventHandler(grid_UpdateCommand);
grid.MasterTableView.EditMode = GridEditMode.InPlace;
}
protected
override
void
UpdateListValuesFromValue()
{
using
(AchieverData entities =
new
AchieverData())
{
List<StandardWithWeighting> list2 = ((ObjectQuery<StandardWithWeighting>)from n
in
entities.Standard join b
in
entities.ItemStandards on n.Id equals b.Standard.Id
where b.Item.Id == ParentBusinessObject.Id
select
new
StandardWithWeighting() { Standard = n, Rating = b.Weighting }).ToList();
this
.ListValues = list2;
}
}
protected
override
object
GetGridDataSource()
{
return
this
.ListValues;
}
When a new standard is added (via the dialog - not shown), the following method is called.
protected
virtual
void
OnStandardsSelected(IEnumerable<Standard> newStandards)
{
if
(newStandards ==
null
)
return
;
List<StandardWithWeighting> sww =
new
List<StandardWithWeighting>();
foreach
(Standard s
in
newStandards)
sww.Add(
new
StandardWithWeighting() { Standard = s, Rating =
new
Decimal(0.0) });
IEnumerable<StandardWithWeighting> allStandardsWithWeightings = ((List<StandardWithWeighting>)ListValues).Union(sww,
new
StandardWithWeightingEqualityComparer()).ToList();
IEnumerable<StandardWithWeighting> newStandardsWithWeightings = (sww.ToList().Except((List<StandardWithWeighting>)ListValues,
new
StandardWithWeightingEqualityComparer())).ToList();
ListValues = allStandardsWithWeightings;
foreach
(StandardWithWeighting s
in
newStandardsWithWeightings)
{
ItemStandards iss =
new
ItemStandards() { ParentId = ParentBusinessObject.Id, StandardId = s.Standard.Id, Weighting =
new
Decimal(0.0) };
ParentBusinessObject.Standards.Add(iss);
}
base
.SynchroniseDisplay();
}
0
Hello Mathew,
I could not spot anything wrong with your code, neither could I see the implementation of your custom pages where the problem lies going by your last post. That's why I'd ask you to isolate the issue into a more manageable sample that can be run on our side, open up a formal support ticket and send it to us for debugging. Thanks in advance for that.
Greetings, Tsvetoslav
the Telerik team
I could not spot anything wrong with your code, neither could I see the implementation of your custom pages where the problem lies going by your last post. That's why I'd ask you to isolate the issue into a more manageable sample that can be run on our side, open up a formal support ticket and send it to us for debugging. Thanks in advance for that.
Greetings, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Mathew
Top achievements
Rank 1
answered on 18 Oct 2011, 09:18 AM
Hi Tsvetoslav,
Thanks for your help, I'll see if I can get something together to send to support.
Mathew
Thanks for your help, I'll see if I can get something together to send to support.
Mathew
0

Mathew
Top achievements
Rank 1
answered on 03 Nov 2011, 05:04 PM
I wasn't able to get a sample project to send off in the end, but I did manage to get around the problem by adding a style sheet manager to the page.