Hello,
I am using a RadTimePicker template column in a radgrid (both are RadControls for ASP.NET Q2 2008). I initialized StartTime and EndTime for the time pickers, but it does not take effect in the client side - the picker still displays time range from 12:00AM to 23:30. Here is the ASP page (there is only one radgrid control on the page):
<rad:radgrid id="gdActivityTime" runat="server" skin="Office2007" Autogeneratecolumns="false" width="95%">
<MasterTableView DataKeyNames="ActivityNodeID" ShowHeader="false">
<Columns>
<rad:GridBoundColumn DataField="ActivityName" HeaderText="Activity"></rad:GridBoundColumn>
<rad:GridTemplateColumn>
<ItemTemplate>
<rad:RadTimePicker AutoPostBack="true" ID="pkDesignatedStartTime" runat="server" Width="85px" >
<TimeView ID="TimeView1" runat="server" Skin="" Interval="0:30">
</TimeView>
<PopupButton Visible="False" />
<DatePopupButton Visible="False" />
<DateInput Skin="" />
</rad:RadTimePicker>
</ItemTemplate>
</rad:GridTemplateColumn>
</Columns>
</MasterTableView>
</rad:radgrid>
Here is the code behind:
//generate 10 rows:
DataTable tblActTime = new DataTable();
tblActTime.Columns.Add(new DataColumn("ActivityName", typeof(string)));
tblActTime.Columns.Add(new DataColumn("DesignatedStartTime", typeof(TimeSpan)));
tblActTime.Columns.Add(new DataColumn("ActivityNodeID", typeof(string)));
for(int n=0; n<10; n++)
{
DataRow dract = tblActTime.NewRow();
dract["ActivityName"] = string.Format("Activity{0}", n);
dract["ActivityNodeID"] = n;
tblActTime.Rows.Add(dract);
}
gdActivityTime.DataSource = tblActTime;
gdActivityTime.DataBind();
//initialize start/end time for all time picker in the grid:
TimeSpan dtStart = new TimeSpan(0, 8, 0);
TimeSpan dtEnd = new TimeSpan(0, 21, 0);
foreach (GridDataItem pkgItem in gdActivityTime.MasterTableView.Items)
{
DataRowView drx = pkgItem.DataItem as DataRowView;
RadTimePicker dp = pkgItem.FindControl("pkDesignatedStartTime") as RadTimePicker;
dp.TimeView.StartTime = dtStart;
dp.TimeView.EndTime = dtEnd;
}
Thank you in advance.
We are using treeview under the RadComboBox. Some nodes are disable in treeview. Now when user try to select disable node in treeview then we are not allowing user to select node and cancelling the event at client site using this args.set_cancel(true) under this event OnClientNodeClicking.
After that we like to keep displaying previous selected node text value in combobox text because new node selection is invalid due to disable node.
Now our problem is that after the post back in first client site event combo box doesn't able to show valid selected node value it shows value of all node text. after that from 2nd client side event onwards it works properly and started showing only selected node value and igonring disable node value in combo box.
Here is the code which we have writtren OnClientNodClicking.
function nodeClicking1(sender, args)
{
var comboBox = $find("<%= RadComboBox2.ClientID %>");
var node = args.get_node();
var parentnode = node.get_parent();
var tree = comboBox.get_items().getItem(0).findControl("RadTreeView3");
var selectedNode = tree.get_selectedNode();
var selectedtext = selectedNode.get_text();
if (parentnode != null && node.get_enabled())
{
comboBox.set_text(node.get_text());
comboBox.trackChanges();
comboBox.get_items().getItem(0).set_value(node.get_text());
comboBox.set_text(node.get_text());
comboBox.commitChanges();
comboBox.hideDropDown();
}
else
{
args.set_cancel(
true);
//keep showing previous enable node value and igoner disable node value
comboBox.set_text(selectedtext);
comboBox.trackChanges();
comboBox.set_text(selectedtext);
comboBox.commitChanges();
comboBox.showDropDown();
}
}
| <asp:Label runat="server" ID="hdnPId" Text="1"></asp:Label> |
| <telerik:RadGrid ID="RadGrid1" Skin="Vista" Width="97%" runat="server" ShowFooter="True" |
| PageSize="7" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" |
| OnItemDataBound="RadGrid1_ItemDataBound" GridLines="None" DataSourceID="CaptureDataSource" |
| ValidationSettings-EnableValidation="true" ValidationSettings-ValidationGroup="ConfigConfigValidationGroup"> |
| <HeaderContextMenu Skin="Vista" EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <MasterTableView Width="100%" GridLines="None" CommandItemDisplay="Top" EditMode="InPlace" |
| AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" |
| HorizontalAlign="NotSet" AutoGenerateColumns="False" DataKeyNames="iCaptureId" |
| DataSourceID="CaptureDataSource"> |
| <CommandItemTemplate> |
| <div style="padding: 0 5px;"> |
| <asp:LinkButton ValidationGroup="ConfigConfigValidationGroup" ID="btnCancel" runat="server" |
| CommandName="CancelAll" CausesValidation="false" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="./Img/Cancel.gif" />Cancel</asp:LinkButton> |
| <asp:LinkButton ValidationGroup="ConfigConfigValidationGroup" ID="Add" runat="server" |
| CommandName="InitInsert" CausesValidation="false" Enabled='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="/Img/AddRecord.gif" />Add Capture</asp:LinkButton> |
| <asp:LinkButton ValidationGroup="ConfigConfigValidationGroup" ID="LinkButton1" CausesValidation="false" |
| OnClientClick="javascript:return confirm('Delete Selected Capture?')" runat="server" |
| CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="/Img/Delete.gif" />Delete</asp:LinkButton> |
| <asp:LinkButton ID="LinkButton3" ValidationGroup="ConfigConfigValidationGroup" runat="server" |
| CausesValidation="false" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'>Add this Customer</asp:LinkButton> |
| </div> |
| <%-- <div style="padding: 0 5px;"> |
| Custom command item template |
| <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'>Edit selected</asp:LinkButton> |
| <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'>Update</asp:LinkButton> |
| <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'>Cancel editing</asp:LinkButton> |
| <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'>Add new</asp:LinkButton> |
| <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'>Add this Customer</asp:LinkButton> |
| <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')" |
| runat="server" CommandName="DeleteSelected">Delete selected customers</asp:LinkButton> |
| <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid">Refresh customer list</asp:LinkButton> |
| </div>--%> |
| </CommandItemTemplate> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" UpdateImageUrl="..\Img\Update.gif" |
| EditImageUrl="..\Img\Edit.gif" InsertImageUrl="..\Img\Insert.gif" CancelImageUrl="..\Img\Cancel.gif"> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn DataField="iCaptureId" DataType="System.Int32" HeaderText="iCaptureId" |
| ReadOnly="True" SortExpression="iCaptureId" UniqueName="iCaptureId"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="iPackageId" DataType="System.Int32" HeaderText="iPackageId" |
| SortExpression="iPackageId" UniqueName="iPackageId"> |
| </telerik:GridBoundColumn> |
| <telerik:GridDropDownColumn DataField="iCaptureType" HeaderText="iCaptureType" SortExpression="iCaptureType" |
| UniqueName="iCaptureType" DataType="System.Int32" DropDownControlType="DropDownList"> |
| </telerik:GridDropDownColumn> |
| <telerik:GridBoundColumn DataField="nvcAlias" HeaderText="nvcAlias" SortExpression="nvcAlias" |
| UniqueName="nvcAlias"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="nvcCtiTrunk" HeaderText="nvcCtiTrunk" SortExpression="nvcCtiTrunk" |
| UniqueName="nvcCtiTrunk"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="iBoardNumber" DataType="System.Int32" HeaderText="iBoardNumber" |
| SortExpression="iBoardNumber" UniqueName="iBoardNumber"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="iBoardTrunk" DataType="System.Int32" HeaderText="iBoardTrunk" |
| SortExpression="iBoardTrunk" UniqueName="iBoardTrunk"> |
| </telerik:GridBoundColumn> |
| <telerik:GridDropDownColumn DataField="nvcFrameFormat" HeaderText="nvcFrameFormat" |
| DropDownControlType="DropDownList" SortExpression="nvcFrameFormat" UniqueName="nvcFrameFormat"> |
| </telerik:GridDropDownColumn> |
| <telerik:GridDropDownColumn DataField="bitSummed" HeaderText="bitSummed" SortExpression="bitSummed" |
| UniqueName="bitSummed" DropDownControlType="DropDownList"> |
| </telerik:GridDropDownColumn> |
| <telerik:GridBoundColumn DataField="iNumOfChannels" HeaderText="iNumOfChannels" SortExpression="iNumOfChannels" |
| UniqueName="iNumOfChannels" DataType="System.Int32"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="iUsedChannels" DataType="System.Int32" HeaderText="iUsedChannels" |
| SortExpression="iUsedChannels" UniqueName="iUsedChannels"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="nvcFirstTimeSlot" HeaderText="nvcFirstTimeSlot" |
| SortExpression="nvcFirstTimeSlot" UniqueName="nvcFirstTimeSlot"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| <EditFormSettings CaptionDataField="iCaptureId"> |
| <FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle> |
| <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> |
| <FormStyle Width="100%" BackColor="#eef2ea"></FormStyle> |
| <EditColumn ButtonType="ImageButton" /> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" /> |
| </ClientSettings> |
| <FilterMenu Skin="Vista" EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
| <asp:ObjectDataSource ID="CaptureDataSource" runat="server" DeleteMethod="Delete" |
| InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="Fill" |
| TypeName="NPEWebApplication.Configurations.RecordingConfiguration.ConfigControls.CaptureDataSource" |
| UpdateMethod="Update"> |
| <DeleteParameters> |
| <asp:Parameter Name="iCaptureId" Type="String" /> |
| <asp:Parameter Name="original_iCaptureId" Type="Int32" /> |
| </DeleteParameters> |
| <UpdateParameters> |
| <asp:Parameter Name="nvcFrameFormat" Type="String" /> |
| <asp:Parameter Name="iUsedChannels" Type="Int32" /> |
| <asp:Parameter Name="iBoardNumber" Type="Int32" /> |
| <asp:Parameter Name="iNumOfChannels" Type="Int32" /> |
| <asp:Parameter Name="nvcAlias" Type="String" /> |
| <asp:Parameter Name="nvcFirstTimeSlot" Type="String" /> |
| <asp:Parameter Name="iPackageId" Type="Int32" /> |
| <asp:ControlParameter ControlID="txtCaptureType" Name="iCaptureType" Type="Int32" |
| PropertyName="Text" /> |
| <asp:Parameter Name="iBoardTrunk" Type="Int32" /> |
| <asp:Parameter Name="bitSummed" Type="String" /> |
| <asp:Parameter Name="nvcCtiTrunk" Type="String" /> |
| <asp:Parameter Name="original_iCaptureId" Type="Int32" /> |
| </UpdateParameters> |
| <SelectParameters> |
| <asp:ControlParameter ControlID="hdnPId" Name="iPackageId" PropertyName="Text" |
| Type="Int32" /> |
| </SelectParameters> |
| <InsertParameters> |
| <asp:Parameter Name="nvcFrameFormat" Type="String" /> |
| <asp:Parameter Name="iUsedChannels" Type="Int32" /> |
| <asp:Parameter Name="iBoardNumber" Type="Int32" /> |
| <asp:Parameter Name="iNumOfChannels" Type="Int32" /> |
| <asp:Parameter Name="nvcAlias" Type="String" /> |
| <asp:Parameter Name="nvcFirstTimeSlot" Type="String" /> |
| <asp:ControlParameter ControlID="hdnPId" Name="iPackageId" PropertyName="Text" |
| Type="Int32" /> |
| <asp:ControlParameter ControlID="txtCaptureType" Name="iCaptureType" Type="Int32" |
| PropertyName="Text" /> |
| <asp:Parameter Name="iBoardTrunk" Type="Int32" /> |
| <asp:Parameter Name="bitSummed" Type="String" /> |
| <asp:Parameter Name="nvcCtiTrunk" Type="String" /> |
| </InsertParameters> |
| </asp:ObjectDataSource> |
| <script language="javascript" type="text/javascript"> |
| <!-- |
| function openWin() |
| { |
| var o = $get('ctl00$ContentMain$hdnIDPGUID'); |
| if(null != o) |
| { |
| var oWnd = radopen("IDPHistory.aspx?GUID=" + o.value, "RadWindow1"); |
| oWnd.RestrictionZoneID = "divbody"; |
| } |
| } |
| function openMailWin(mailid, idpguid, dnguid) |
| { |
| var oWnd = radopen('IDPMail.aspx?MailID=' + mailid + '&idpguid=' + idpguid + '&dnguid=' + dnguid, "RadWindowEmail"); |
| oWnd.add_close(OnClientClose); |
| } |
| function closeWindow() |
| { |
| var currentWindow = GetRadWindow(); |
| } |
| //--> |
| </script> |
| <telerik:RadWindowManager VisibleStatusbar="false" Skin="WebBlue" Width="550" Height="650" DestroyOnClose="true" KeepInScreenBounds="true" ID="RadWindowManager1" runat="server" Behaviors="Minimize, Move, Close, Pin, Reload" RestrictionZoneID="divbody"> |
| </telerik:RadWindowManager> |
DataBinding: 'Telerik.WebControls.GridInsertionObject' does not contain a property with the name 'subject'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinding: 'Telerik.WebControls.GridInsertionObject' does not contain a property with the name 'subject'.
The error results from initiating an insert from a grid that has no rows/records. If the grid has existing records, the insert works fine.
What I found, in my case, is a simple fix to the problem. My SqlData Source was:
<asp:SqlDataSource ID="dsParent" runat="server" DataSourceMode="DataReader"></asp:SqlDataSource>
The problem disappeared by removing the DataSourceMode property thus:
<asp:SqlDataSource ID="dsParent" runat="server"></asp:SqlDataSource>
I hope this will help someone down the line who runs into this problem again. This may not solve everyones problem with this error message, but it fixed mine. Happy coding!