or
| private GridDateTimeColumn CreateDateGridColumn(string fieldname) |
| { |
| GridDateTimeColumn DT = new GridDateTimeColumn(); |
| DT.UniqueName = fieldname; |
| DT.HeaderText = "fieldname"; |
| DT.PickerType = GridDateTimeColumnPickerType.DatePicker; |
| DT.DataFormatString = "{0:MM/dd/yyyy}"; |
| DT.ColumnEditorID = fieldname + "Editor"; |
| DT.DataField = fieldname; |
| DT.SortExpression = fieldname; |
| DT.ItemStyle.Width = Unit.Pixel(120); |
| DT.FilterControlWidth = Unit.Pixel(50); |
| DT.EmptyDataText = " "; |
| return DT; |
| } |
Hi,
I am facing a problem while using RadDatePicker in IE8, below is the code:
| <script language="javascript" type="text/javascript"> |
| function fireHiddenButton(sender, args) { |
| var textBox1 = $find("<%= startDate.ClientID %>").get_selectedDate(); |
| var textBox2 = $find("<%= endDate.ClientID %>").get_selectedDate(); |
| if (textBox1 != null && textBox2 != null ) { |
| $get("<%= submitForm.ClientId %>").click(); |
| } |
| } |
| </script> |
| <table> |
| <tr> |
| <td> |
| Start Date |
| </td> |
| <td> |
| <telerik:RadDatePicker ID="startDate" ShowPopupOnFocus="true" runat="server"> |
| <ClientEvents OnPopupClosing="fireHiddenButton" /> |
| </telerik:RadDatePicker> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| End Date |
| </td> |
| <td> |
| <telerik:RadDatePicker ID="endDate" ShowPopupOnFocus="true" runat="server"> |
| <ClientEvents OnPopupClosing="fireHiddenButton" /> |
| </telerik:RadDatePicker> |
| </td> |
| </tr> |
| </table> |
| <asp:LinkButton style="display:none" ID="submitForm" runat="server"> |
| private void RenderExpand(HtmlTextWriter writer) |
| { |
| if (this.Expanded && (this.ExpandMode != TreeNodeExpandMode.ServerSideCallBack)) |
| { |
| writer.AddAttribute(HtmlTextWriterAttribute.Class, "rtMinus"); |
| } |
| else |
| { |
| writer.AddAttribute(HtmlTextWriterAttribute.Class, "rtPlus"); |
| } |
| writer.RenderBeginTag(HtmlTextWriterTag.Span); |
| writer.RenderEndTag(); |
| } |
| .RadPanelBar_JonDan |
| { |
| background: #f8f8f8 !Important; |
| font-family: Verdana, Arial, helvetica, sans-serif !Important; |
| font-size: 11px !Important; |
| line-height: 24px !Important; |
| } |
| .RadPanelBar_JonDan .rpRootGroup |
| { |
| border: solid 1px #f0f0f0; |
| } |
| .RadPanelBar_JonDan .rpRootGroup .rpLink |
| { |
| background: #fff !Important; |
| font-weight: bold; |
| font-size: 12px; |
| border: none !Important; |
| color: #cc0000; |
| } |
| .RadPanelBar_JonDan .rpRootGroup .rpFocused, |
| .RadPanelBar_JonDan .rpRootGroup .rpLink:hover |
| { |
| background: #fff url('PanelBar/RootItemBg.png') 0 -1px !Important; |
| color: #fff; |
| } |
| .RadPanelBar_JonDan .rpGroup .rpLink |
| { |
| background: #f8f8f8 none !Important; |
| border-top: solid 1px #fff !Important; |
| border-bottom: solid 1px #f0f0f0 !Important; |
| border-left: solid 1px #f8f8f8 !Important; |
| border-right: solid 1px #f8f8f8 !Important; |
| font-weight: normal; |
| color: #666 !Important; |
| } |
| .RadPanelBar_JonDan .rpGroup .rpFocused, |
| .RadPanelBar_JonDan .rpGroup .rpLink:hover |
| { |
| background: #fff none !Important; |
| border-top: solid 1px #fff !Important; |
| border-bottom: solid 1px #e6e6e6 !Important; |
| border-left: solid 1px #f8f8f8 !Important; |
| border-right: solid 1px #f8f8f8 !Important; |
| font-weight: normal; |
| color: #ff0000 !Important; |
| } |
| .RadPanelBar_JonDan .rpOut |
| { |
| border-color: #f8f8f8 !Important; |
| } |
| .RadPanelBar_JonDan .rpExpanded |
| { |
| border-color: #f8f8f8; |
| } |
| /* <disabled items> */ |
| .RadPanelBar_JonDan .rpDisabled, |
| .RadPanelBar_JonDan .rpDisabled:hover |
| { |
| color: #ccc; |
| } |
| .RadPanelBar_JonDan .rpDisabled:hover |
| { |
| border-color: #002d96; |
| } |
| .RadPanelBar_JonDan .rpDisabled .rpOut, |
| .RadPanelBar_JonDan .rpDisabled:hover .rpOut |
| { |
| border-color: #89aee5; |
| } |
| /* </disabled items> */ |
| /* <expand arrows> */ |
| .RadPanelBar_JonDan .rpExpandable .rpText, |
| .RadPanelBar_JonDan .rpExpanded .rpText |
| { |
| background-color: transparent; |
| background-image: url('PanelBar/Expandable.gif'); |
| } |
| /* </expand arrows> */ |
| /* <expand arrows override> */ |
| .RadPanelBar .rpExpandable .rpText, |
| .RadPanelBar .rpExpanded .rpText |
| { |
| padding-right: 20px; |
| background-repeat: no-repeat; |
| } |
| .RadPanelBar_rtl .rpExpandable .rpText, |
| .RadPanelBar_rtl .rpExpanded .rpText |
| { |
| padding-left: 20px; |
| } |
| .RadPanelBar_rtl .rpGroup .rpText |
| { |
| padding: 0 10px; |
| } |
| .RadPanelBar .rpExpandable .rpText { background-position: 100% 0; } |
| .RadPanelBar .rpExpanded .rpText { background-position: 100% -176px; } |
| .RadPanelBar_rtl .rpExpandable .rpText { background-position: 0 0; } |
| .RadPanelBar_rtl .rpExpanded .rpText { background-position: 0 -176px; } |
| .RadPanelBar .rpExpandable:hover .rpText, |
| .RadPanelBar .rpExpandable.rpSelected .rpText, |
| .RadPanelBar .rpExpandable.rpSelected:hover .rpText |
| { |
| background-position: 100% -337px; |
| } |
| .RadPanelBar .rpExpanded:hover .rpText, |
| .RadPanelBar .rpExpanded.rpSelected .rpText, |
| .RadPanelBar .rpExpanded.rpSelected:hover .rpText |
| { |
| background-position: 100% -476px; |
| } |
| .RadPanelBar_rtl .rpExpandable:hover .rpText, |
| .RadPanelBar_rtl .rpExpandable.rpSelected .rpText, |
| .RadPanelBar_rtl .rpExpandable.rpSelected:hover .rpText |
| { |
| background-position: 0 -337px; |
| } |
| .RadPanelBar_rtl .rpExpanded:hover .rpText, |
| .RadPanelBar_rtl .rpExpanded.rpSelected .rpText, |
| .RadPanelBar_rtl .rpExpanded.rpSelected:hover .rpText |
| { |
| background-position: 0 -476px; |
| } |
| /* </expand arrows override> */ |
| /* <subitems> */ |
| .RadPanelBar_JonDan .rpGroup |
| { |
| background-color: #fff; |
| } |
| .RadPanelBar_JonDan .rpGroup .rpLink, |
| .RadPanelBar_JonDan .rpGroup .rpTemplate |
| { |
| color: #000; |
| background-color: transparent; |
| background-image: none; |
| line-height: 20px; |
| min-height: 20px; |
| } |
| * html .RadPanelBar_JonDan .rpGroup .rpLink { height: 20px; } |
| .RadPanelBar_JonDan .rpGroup .rpLink |
| { |
| background-color: transparent; |
| background-image: none; |
| padding: 1px; |
| margin: 0 1px; |
| } |
| .RadPanelBar_JonDan .rpGroup .rpOut |
| { |
| border-bottom: 0; |
| margin-right: 3px; |
| } |
| /* <subitems (disabled)> */ |
| .RadPanelBar_JonDan .rpGroup .rpItem .rpDisabled, |
| .RadPanelBar_JonDan .rpGroup .rpItem .rpDisabled:hover, |
| .RadPanelBar_JonDan .rpGroup .rpItem .rpDisabled:hover .rpOut |
| { |
| background-image: none; |
| } |
| .RadPanelBar_JonDan .rpGroup .rpItem .rpDisabled, |
| .RadPanelBar_JonDan .rpGroup .rpItem .rpDisabled:hover |
| { |
| color: #999; |
| text-decoration: none; |
| background-color: #fff; |
| border: 0; |
| padding: 1px; |
| } |
| .RadPanelBar_JonDan .rpGroup .rpItem .rpDisabled:hover .rpOut |
| { |
| border-bottom: 0; |
| } |
| /* </subitems (disabled)> */ |
| /* <subitems> */ |
| <link href="../Styling/ProductPanel.css" rel="stylesheet" type="text/css" /> <telerik:RadPanelBar ID="RadPanelBar1" Runat="server" DataFieldID="productID" |
| DataFieldParentID="productParentID" DataSourceID="adsProducts" |
| DataTextField="productTitle" DataValueField="productID" Width="250px" EnableEmbeddedSkins="false" Skin="RadPanelBar_JonDan"> |
| </telerik:RadPanelBar> |
RadGrid1.DataSource = handler.Find(); ->
| public IList<Company1.Grid.Data.DataTransferObjects.KravDTO> Find() |
| { |
| using (Company1LinqDSDataContext context = new Company1LinqDSDataContext()) |
| { |
| return (from k in context.Kravs |
| select new Company1.Grid.Data.DataTransferObjects.KravDTO() |
| { |
| Anr=k.anrr, |
| ID=k.ID, |
| Kund=k.Kund |
| }).ToList(); |
| } |
| } |
Hence the RadGrid is populated with an IList as datasource.
This works fine! However the filtering and paging functions only work once every refresh. E.g: Navigate to the page containing the RadGrid. Filter/change page or anything like that and the filtering and ability to change number of items per page stops working.
The paging itself (clicking the navigation) and sorting still works.
If i refresh the page the filtering and "number per page" function works again until the next action.
The only error message i get is: "'null' is null or not an object".
My .ascx code:
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="RadGrid1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <telerik:RadGrid ID="RadGrid1" Width="97%" |
| AllowPaging="True" PageSize="25" runat="server" AllowFilteringByColumn="True" AllowSorting="True" |
| OnNeedDataSource="RadGrid1_NeedDataSource" GridLines="None"> |
| <MasterTableView Width="100%" /> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </FilterMenu> |
| </telerik:RadGrid> |
Any ideas?
| protected override void Page_Init(object sender, EventArgs e) |
| { |
| base.Page_Init(sender, e); |
| CreateGrid(); |
| } |
| protected void Page_Load(object sender, System.EventArgs e) |
| { |
| lblLocation.Text = Location.Title; |
| if (!IsPublished) |
| { |
| lblStatus.Text = " - " + _location.Status.ToString(); |
| lblStatus.Visible = true; |
| } |
| if (_ajaxmanager != null) |
| { |
| _ajaxmanager.AjaxSettings.AddAjaxSetting(Grid, Grid); |
| } |
| } |
| public void CreateGrid() |
| { |
| GridButtonColumn edit_col = new GridButtonColumn(); |
| edit_col.Text = "wijzig"; |
| edit_col.UniqueName = "EditColumn"; |
| edit_col.CommandName = "Edit"; |
| edit_col.ItemStyle.Width = Unit.Pixel(35); |
| GridButtonColumn copy_col = new GridButtonColumn(); |
| copy_col.Text = "kopieer"; |
| copy_col.UniqueName = "CopyColumn"; |
| copy_col.CommandName = "Copy"; |
| copy_col.ItemStyle.Width = Unit.Pixel(40); |
| GridButtonColumn del_col = new GridButtonColumn(); |
| del_col.Text = "verwijder"; |
| del_col.UniqueName = "DeleteColumn"; |
| del_col.CommandName = "Delete"; |
| del_col.ItemStyle.Width = Unit.Pixel(50); |
| RadGrid grid = new RadGrid(); |
| grid.UpdateCommand += new GridCommandEventHandler(grid_UpdateCommand); |
| grid.DeleteCommand += new GridCommandEventHandler(grid_DeleteCommand); |
| //grid.ItemDataBound += new GridItemEventHandler(grid_ItemDataBound); |
| grid.ID = "grdFreeplaces"; |
| grid.AutoGenerateColumns = false; |
| grid.ShowStatusBar = true; |
| grid.Width = Unit.Pixel(737); |
| grid.ClientSettings.AllowKeyboardNavigation = true; |
| grid.ClientSettings.KeyboardNavigationSettings.InitInsertKey = GridFocusKeys.I; |
| grid.MasterTableView.EditFormSettings.EditFormType = GridEditFormType.Template; |
| grid.MasterTableView.EditFormSettings.FormTemplate = new VisualObjectEditorFreeDaysFormTemplate(this, _location); |
| grid.MasterTableView.CommandItemSettings.AddNewRecordText = "Toevoegen"; |
| grid.MasterTableView.CommandItemSettings.RefreshText = "Herladen"; |
| if (IsPublished) |
| grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom; |
| else |
| grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; |
| grid.MasterTableView.EditMode = GridEditMode.PopUp; |
| grid.MasterTableView.EditFormSettings.PopUpSettings.Width = Unit.Pixel(765); |
| grid.MasterTableView.EditFormSettings.PopUpSettings.Height = Unit.Pixel(240); |
| grid.DataSource = Location.FreePlaces; |
| grid.MasterTableView.DataKeyNames = new string[] { "LexiconItemID" }; |
| if (IsPublished) grid.MasterTableView.Columns.Add(edit_col); |
| if (IsPublished) grid.MasterTableView.Columns.Add(del_col); |
| grid.MasterTableView.Columns.Add(CreateDataColumn("Omschrijving", "Description")); |
| grid.MasterTableView.Columns.Add(CreateDataColumn("Leeftijd", "AgeRangeDescription")); |
| phFreePlace.Controls.Add(grid); |
| } |
| protected void grid_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| bool isnew = false; |
| GridEditableItem item = e.Item as GridEditableItem; |
| VisualObjectEditor editor = (e.CommandSource as Button).Parent.FindControl("edtFormTemplate") as VisualObjectEditor; |
| LexiconItem freeplace = null; |
| Location.Location.Document.ContentControl.CheckOut(Framework, Framework.ActiveUser); |
| if (item.ItemIndex < 0) |
| { |
| freeplace = _location.Location.CreateNewFreePlace().LexiconItem; |
| isnew = true; |
| } |
| else |
| freeplace = Location.FindFreePlace(item.OwnerTableView.DataKeyValues[item.ItemIndex]["LexiconItemID"].ToString()).LexiconItem; |
| editor.GetContentStorageValues(freeplace.Content.DocumentType, freeplace.Content); |
| if (editor.Validate(freeplace)) |
| { |
| Location.Location.GetFreePlaceContentField().LexiconItems.Add(freeplace); |
| Location.Location.Document.ContentControl.Publish(Framework, Framework.ActiveUser); |
| Grid.DataSource = Location.FreePlaces; |
| Grid.Rebind(); |
| } |
| else |
| { |
| Location.Location.Document.ContentControl.UndoCheckOut(Framework, Framework.ActiveUser); |
| e.Canceled = true; |
| } |
| } |
| protected void grid_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| Location.Location.Document.ContentControl.CheckOut(Framework, Framework.ActiveUser); |
| string lexiconitemid = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LexiconItemID"].ToString(); |
| Location.Location.DeleteFreePlace(lexiconitemid); |
| Location.Location.Document.ContentControl.Publish(Framework, Framework.ActiveUser); |
| Grid.DataSource = Location.FreePlaces; |
| Grid.Rebind(); |
| } |
| <httpModules> |
| <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> |
| <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/> |
| <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule"/> |
| </httpModules> |
| <telerik:RadGrid runat="server" ID="grdIODump" Skin="Black" |
| AutoGenerateColumns="False" GridLines="None" |
| AllowPaging="True" AllowSorting="True" PageSize="31" |
| GroupingEnabled="False" Font-Names="Tahoma" Font-Size="10pt"> |
| <MasterTableView NoMasterRecordsText="اطلاعاتی برای نمایش موجود نمی باشد"> |
| <Columns> |
| <telerik:GridBoundColumn DataField="enterDayName" HeaderText="روز ورود" |
| UniqueName="enterDayName" AllowSorting="False"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="BEGINDATE" HeaderText="تاریخ ورود" |
| UniqueName="BEGINDATE"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="BEGINTIME" HeaderText=" ساعت ورود" |
| UniqueName="BEGINTIME" AllowSorting="false"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="exitDayName" HeaderText="روز خروج" |
| UniqueName="exitDayName" AllowSorting="False"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="ENDDATE" HeaderText="تاریخ خروج" |
| UniqueName="ENDDATE" AllowSorting="False"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="ENDTIME" HeaderText="ساعت خروج" |
| UniqueName="ENDTIME" AllowSorting="False"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="DURATION" HeaderText="میزان کارکرد" |
| UniqueName="DURATION"> |
| <HeaderStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| <ItemStyle Font-Names="Tahoma" Font-Size="10pt" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings ReorderColumnsOnClient="True"> |
| </ClientSettings> |
| </telerik:RadGrid> |