
I have a radgrid that binds an object stored in the ViewState (Case). When I click on the radgrid's "Add" button (firing the OnInsertCommand) I get the following error: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'LookupValue'.' The specific control I am having problems with is the RadDropDownTree, and only when its definition contains this "SelectedValue='<%# Bind("LookupValue.Code") %>'"
I do not understand why this is happening. What is so different now that my radgrid is binding to a object that contains a subobject?? What do I need to be doing differently?
Just as an fyi, I do not get this error when the OnUpdateCommand fires. Below is my code.
<telerik:RadGrid ID="gvAllegations" runat="server"
AllowAutomaticDeletes="false"
AllowAutomaticInserts="false"
AllowAutomaticUpdates="false"
AllowFilteringByColumn="false"
AllowMultiRowEdit="false"
AllowMultiRowSelection="false"
AllowPaging="false"
AllowSorting="false"
AutoGenerateColumns="false"
OnNeedDataSource="gvAllegations_NeedDataSource"
OnInsertCommand="gvAllegations_InsertCommand"
OnUpdateCommand="gvAllegations_UpdateCommand">
<ClientSettings Selecting-AllowRowSelect="true" />
<GroupingSettings CaseSensitive="false" />
<MasterTableView
CommandItemDisplay="Top"
DataKeyNames="CaseAllegationID"
ClientDataKeyNames="CaseAllegationID">
<Columns>
<telerik:GridBoundColumn UniqueName="AllegationType" DataField="Type" HeaderText="Type" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
<telerik:GridBoundColumn UniqueName="AllegationCodeDescription" DataField="LookupValue.CodeDescription" HeaderText="Allegation" />
</Columns>
<CommandItemTemplate>
<div class="CommandButtonDiv">
<asp:LinkButton ID="LinkButton2" runat="server"
CssClass="CommandButton"
CommandName="InitInsert"
Visible='<%# !gvAllegations.MasterTableView.IsItemInserted && gvAllegations.EditIndexes.Count == 0 %>'>
<img src="Images/AddRecord.png"/> Add
</asp:LinkButton>
<asp:LinkButton ID="btnEditSelected" runat="server"
CssClass="CommandButton"
CommandName="EditSelected"
Visible='<%# !gvAllegations.MasterTableView.IsItemInserted && gvAllegations.EditIndexes.Count == 0 %>'>
<img src="Images/Edit.png" /> Edit
</asp:LinkButton>
<asp:LinkButton ID="LinkButton1" runat="server"
CssClass="CommandButton"
CommandName="DeleteSelected"
Visible='<%# !gvAllegations.MasterTableView.IsItemInserted && gvAllegations.EditIndexes.Count == 0 %>'>
<img src="Images/Delete.png"/> Delete
</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server"
CssClass="CommandButton"
CommandName="RebindGrid"
Visible='<%# !gvAllegations.MasterTableView.IsItemInserted && gvAllegations.EditIndexes.Count == 0 %>'>
<img src="Images/Refresh.png"/> Refresh
</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server"
CssClass="CommandButton"
CommandName="PerformInsert" Visible='<%# gvAllegations.MasterTableView.IsItemInserted %>'>
<img src="Images/Insert.gif"/> Save
</asp:LinkButton>
<asp:LinkButton ID="LinkButton5" runat="server"
CssClass="CommandButton"
CommandName="UpdateEdited" Visible='<%# gvAllegations.EditIndexes.Count > 0 %>'>
<img src="Images/Update.png"/> Update
</asp:LinkButton>
<asp:LinkButton ID="btnCancel" runat="server"
CssClass="CommandButton"
CommandName="CancelAll" Visible='<%# gvAllegations.MasterTableView.IsItemInserted || gvAllegations.EditIndexes.Count > 0 %>'>
<img src="Images/Cancel.png"/> Cancel
</asp:LinkButton>
</div>
</CommandItemTemplate>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table style="width: 100%">
<tr>
<td>Allegation</td>
<td>
<telerik:RadDropDownTree ID="ddtAllegation" runat="server"
AutoPostBack="False"
DataFieldId="Code"
DataFieldParentID="ParentCode"
DataValueField="Code"
DataSourceID="odsAllegationLookupValues"
DataTextField="CodeDescription"
EnableFiltering="True"
ExpandNodeOnSingleClick="True"
SelectedValue='<%# Bind("LookupValue.Code") %>'
Width="300px">
<DropDownSettings AutoWidth="Enabled" CloseDropDownOnSelection="true" />
<FilterSettings EmptyMessage="Search Allegation" Filter="Contains" Highlight="Matches" />
</telerik:RadDropDownTree>
</td>
</tr>
<tr>
<td>Major Allegation</td>
<td><telerik:RadCheckBox ID="chbMajorAllegation" runat="server"
AutoPostBack="False" Checked='<%# Bind("IsMajor") %>' /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<telerik:RadButton ID="btnInsert" runat="server"
CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
Width="100px" />
<telerik:RadButton ID="btnCancel" runat="server"
Text="Cancel"
CommandName="Cancel"
Width="100px" />
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
[Serializable]
public class Case
{
public int ID { get; set; }
public List<Allegation> Allegations { get; set; }
}
[Serializable]
public class Allegation
{
public int CaseAllegationID { get; set; }
public bool IsMajor { get; set; }
public string Type
{
get
{
if (IsMajor)
return "Major";
else
return "Other";
}
}
public LookupValue LookupValue { get; set; }
}
[Serializable]
public class LookupValue
{
public string Code { get; set; }
public string Description { get; set; }
public string CodeDescription { get { return Code + " - " + Description; } }
public string ParentCode { get; set; }
public int DimID { get; set; }
public DateTime DimStartDate { get; set; }
public DateTime DimEndDate { get; set; }
public bool DimIsActive { get; set; }
} protected void gvAllegations_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
gvAllegations.DataSource = ((Case)ViewState["rcaCase"]).Allegations;
}
protected void gvAllegations_InsertCommand(object sender, GridCommandEventArgs e)
{
}Good morning ,
I have a datagrid in my project and for some reason one column does not exporting to excel spreadhseet.
The column name is called 'Location'
Please see my html:
telerik:RadGrid ID="EmplReqGrid" runat="server" Skin="Simple"
GridLines="None" AllowPaging="true" AllowSorting="true"
onexcelmlexportrowcreated="EmplReqGrid_ExcelMLExportRowCreated"
onexcelmlexportstylescreated="EmplReqGrid_ExcelMLExportStylesCreated"
onitemcommand="EmplReqGrid_ItemCommand" onitemcreated="EmplReqGrid_ItemCreated"
onitemdatabound="EmplReqGrid_ItemDataBound"
onneeddatasource="EmplReqGrid_NeedDataSource"
onpageindexchanged="EmplReqGrid_PageIndexChanged"
onpagesizechanged="EmplReqGrid_PageSizeChanged"
onpdfexporting="EmplReqGrid_PdfExporting"
onsortcommand="EmplReqGrid_SortCommand" >
<ExportSettings FileName="EmplReqRpt" OpenInNewWindow="true" IgnorePaging="true" ExportOnlyData="true">
<Excel Format="ExcelML" FileExtension="xls"/>
<Pdf FontType="Subset" PaperSize="letter" />
</ExportSettings>
<MasterTableView AutoGenerateColumns="false" AllowMultiColumnSorting="true" >
<HeaderStyle Font-Names="Arial" BackColor="#3974AE" ForeColor="White" Font-Size="Small" />
<Columns>
<telerik:GridBoundColumn HeaderText="Eis-Id" DataField="PRI" UniqueName="PRI" ReadOnly="True" SortExpression="PRI" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Name" DataField="NAME" UniqueName="NAME" Display="false" ></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="ReqNo" DataField="TRKNO" UniqueName="TRKNO" ReadOnly="True" SortExpression="TRKNO" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Job" DataField="JOB" UniqueName="JOB" ReadOnly="True" SortExpression="JOB" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Location" DataField="LOC" UniqueName="LOC" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" ReadOnly="true" SortExpression="LOC" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Term" DataField="TERMID" UniqueName="TERMID" ReadOnly="True" SortExpression="TERMID" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Start Date" DataField="TERMST" UniqueName="TERMST" ReadOnly="true" DataFormatString="{0:MM/dd/yyyy}" SortExpression="TERMST" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="End Date" DataField="TERMEND" UniqueName="TERMEND" ReadOnly="true" DataFormatString="{0:MM/dd/yyyy}" SortExpression="TERMEND" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="No of Days" DataField="NUMP" UniqueName="NUMP" ReadOnly="True" SortExpression="NUMP" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Process Status" DataField="APPRFLAG" UniqueName="APPRFLAG" ReadOnly="True" SortExpression="APPRFLAG" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Rec Status" DataField="STATUS" UniqueName="STATUS" ReadOnly="True" SortExpression="STATUS" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Process Status Date" DataField="FORMDATE" UniqueName="FORMDATE" ReadOnly="True" DataFormatString="{0:MM/dd/yyyy}" SortExpression="FORMDATE" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="REQFLAG" UniqueName="REQFLAG" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="SENDFLAG" UniqueName="SENDFLAG" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BEG_FALL" UniqueName="BEG_FALL" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="END_FALL" UniqueName="END_FALL" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BEG_SPRING" UniqueName="BEG_SPRING" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="END_SPRING" UniqueName="END_SPRING" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BEG_ALL" UniqueName="BEG_ALL" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="END_ALL" UniqueName="END_ALL" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="TRKSEQ" UniqueName="TRKSEQ" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="FLAG" UniqueName="FLAG" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="SCHEDULE" UniqueName="SCHEDULE" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UPDFLAG " UniqueName="UPDFLAG" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="GALFLAG" UniqueName="GALFLAG" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LIC_DESCR" UniqueName="LIC_DESCR" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="HSIND" UniqueName="HSIND" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CFN" UniqueName="CFN" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="APPRNAME" UniqueName="APPRNAME" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="APPREMAIL" UniqueName="APPREMAIL" Display="false"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Link to Form" UniqueName="ButtonColumn" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="150px" >
<ItemTemplate>
<asp:ImageButton ID="ReqFormBtn" ImageUrl="~/Image/update.jpg"
BackColor="#5A8EC1"
ToolTip="update,re-submit or print the request" runat="server" CommandName="Redirect" Width="18px" Height="18px" Visible="false" />
<asp:ImageButton ID="ApprFormBtn" ImageUrl="~/Image/Appr_Button.jpg" BackColor="#5A8EC1"
ToolTip="approve/disapprove request" runat="server" CommandName="Approve" Width="18px" Height="18px" ImageAlign="TextTop" Visible="false" />
<asp:Image ID="Image1" runat="server" ToolTip="HR REQUEST" ImageUrl="~/Image/HR_Request3.jpg" Width="12px" Height="12px" Visible="false" />
<%--<asp:ImageButton ID="CancelReqBtn" ImageUrl="~/Image/Cancel_button6.png" runat="server" CommandName="Cancel" ImageAlign="Right" BackColor="Transparent" ToolTip="cancel the request" Width="50px" Height="20px" Visible="false" OnClientClick="ConfirmCancel(value);" />--%>
<asp:ImageButton ID="GalaxyGBtn" runat="server" ImageUrl="~/Image/Galaxy.png" Width="18px" Height="18px" BackColor="#BDCBDE" ToolTip="galaxy generated/updated request" CommandName="GalaxyRequest" Visible="false" />
<asp:ImageButton ID="PlaceHolderBtn" runat="server" ImageUrl="~/Image/PlaceHolder.jpg" Width="17px" Height="17px" ToolTip="placeholder must be budgeted" Visible="false" BackColor="#BDCBDE" CommandName="PlaceHolderRequest" />
<asp:ImageButton ID="HistoryBtn" runat="server" ImageUrl="~/Image/HistoryReq.png" Width="20px" Height="20px" ToolTip="Archive" BackColor="#BDCBDE" Visible="false" CommandName="HistoryRequest" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick = "false">
<Selecting AllowRowSelect="false" />
</ClientSettings>
</telerik:RadGrid>
And here is event which do exporting:
protected void ExporttoExcel_Click1(object sender, ImageClickEventArgs e)
{
try
{
if (!IsPostBack)
return;
RadGrid ReqInfoGrid = (RadGrid)EmpReqReport.FindItemByValue("EmployeeData").FindControl("EmplReqGrid");
ReqInfoGrid.DataSource = Session["dtGrid"];
ReqInfoGrid.DataBind();
ReqInfoGrid.MasterTableView.GetColumn("NAME").Display = true;
ReqInfoGrid.MasterTableView.ExportToExcel();
}
catch (Exception ex)
{
throw;
}
}
Please help me to resolve this issue.
thanks.
Vitaly.

Hi.
I've read all the previous questions on this but still cannot get it to work.
I need the editor content area to be full width in the page.
Is this possible please?
No other css is affecting this - please see the attached image.
Thanks, Jon
I was wondering how to order just uploaded images order by uploaded date?
There are lots of image in the uploaded folder, once uploaded, it's hard for user to find the image they just uploaded, is there a easy way to order all the images by date uploaded?
Many thanks
Hello!
I was wondering, is it possible to change the icons of the export button in the footer of the radgrid? (Xls, pdf and csv).
I tried modifying their CSS classes, but did not work.
Thanks!