Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
96 views

I have a programmatically created radgrid. One Column in the grid is a GridDateTimeColumn. I have allowed filtering on this column, but I can not get it to filter to the exact date. I initially was trying to do format so I could filter on date and time, but I would settle for just the date at this point if it got it working. The column created code is:

 

GridDateTimeColumn bc40 = new GridDateTimeColumn();
dg.MasterTableView.Columns.Add(bc40);
bc40.PickerType = GridDateTimeColumnPickerType.DatePicker;
bc40.DataField = "LaunchDate";
bc40.HeaderText = "LaunchDate";
bc40.UniqueName = "LaunchDate";
bc40.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
bc40.AutoPostBackOnFilter = true;
bc40.DataFormatString = "{0:MM/dd/yyyy}";
bc40.EnableTimeIndependentFiltering = true;
bc40.FilterDateFormat = "MM/dd/yyyy";
bc40.DataType = typeof(System.DateTime);
bc40.Display = true;

 

I have try muliple variations of FormatString, FilterFormats, Disabled TimeIndepence with no such luck. I though it may be looking directly at the grid's format, so I have also added this to my ItemDataBound event:

 

DateTime launchDateTime = DateTime.Parse(item["LaunchDate"].Text.ToString());
string formattedDateTime = String.Format("{0:MM/dd/yyyy}", launchDateTime);
item["LaunchDate"].Text = formattedDateTime;

 

The date on the grid shows up in the format of 01/01/2016. The format in the filter shows up as 01/01/2016. But when the filter of "Equal To" is set, I don't retrieve any records.

 

This filter is a requirement for my application to work properly. Any help would be greatly appreciated.

 

Eyup
Telerik team
 answered on 12 Jul 2016
3 answers
134 views
I use the Export feature in RadGrids on many pages to export Excel, MSWord and PDF documents.  It works on all but one page.  The culprit throws the PageRequestManagerParserErrorException when Visual Studio is in Debug mode.  Furthermore, if I try to export an Excel document, Fiddler shows that the response header’s Content-Type is “text/plain;  charset=utf-8” instead of “application/vnd.ms-excel;”, and the WebView and Raw view is gobble-de-gook.  Please help.

Christopher
Top achievements
Rank 1
 answered on 11 Jul 2016
1 answer
144 views

Hi,

I am using RadEditor to load a DOCX, replace a few strings with RadFlowDocumentEditor on the ImportContent event, and then export to DOCX.

I am only using the Editor to view the replaced values before exporting to DOCX and I find that layout and formating have changed during the process.

For now, using RTF instead of DOCX and setting Import StylesMode to Inline has brought the best results but some formatting issues remain (tables, numbering, etc.).

How can I make RadEditor perform the least changes?

Thanks

Stanimir
Telerik team
 answered on 11 Jul 2016
27 answers
693 views
Hi,

I've got the following code:

default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs"
    Inherits="default" EnableSessionState="False" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Basic Filtering</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="30"
        BackColor="#dff3ff">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/AjaxLoader-0066cc-W32ByH32.gif"
                        Width="32" Height="32" Style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadCodeBlock runat="server" ID="radCodeBlock">
        <script type="text/javascript">
            function showFilterItem() {
                $find('<%=RadGrid1.ClientID %>').get_masterTableView().showFilterItem();
            }
            function hideFilterItem() {
                $find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
            } 
        </script>
    </telerik:RadCodeBlock>
    <p>
        Show filtering item
        <input id="Radio1" type="radio" runat="server" name="showHideGroup" checked="true"
            onclick="showFilterItem()" /><label for="Radio1">Yes</label>
        <input id="Radio2" type="radio" runat="server" name="showHideGroup" onclick="hideFilterItem()" /><label
            for="Radio2">No</label>
    </p>
    <telerik:RadGrid AutoGenerateColumns="false" ID="RadGrid1" DataSourceID="SqlDataSource1"
        Width="780px" AllowFilteringByColumn="True" AllowSorting="True" PageSize="15"
        ShowFooter="True" AllowPaging="True" runat="server" GridLines="None" EnableLinqExpressions="false">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True"
            ShowFooter="True" TableLayout="Auto">
            <Columns>
                <telerik:GridNumericColumn DataField="Order Id" HeaderText="Order Id" SortExpression="Order Id"
                    UniqueName="Order Id" FilterControlWidth="40px" AutoPostBackOnFilter="false"
                    CurrentFilterFunction="equalto" ShowFilterIcon="false" />
                <telerik:GridBoundColumn FilterControlWidth="150px" DataField="Ship Name" HeaderText="Ship Name"
                    SortExpression="Ship Name" UniqueName="Ship Name" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                <telerik:GridDateTimeColumn FilterControlWidth="70px" DataField="Order Date" HeaderText="Order Date"
                    SortExpression="Order Date" UniqueName="Order Date" PickerType="None" DataFormatString="{0:d}" />
                <telerik:GridDateTimeColumn FilterControlWidth="150px" DataField="Shipped Date" HeaderText="Shipped Date"
                    SortExpression="Shipped Date" UniqueName="Shipped Date" PickerType="DatePicker"
                    DataFormatString="{0:D}">
                    <HeaderStyle Width="260px" />
                </telerik:GridDateTimeColumn>
                <telerik:GridMaskedColumn FilterControlWidth="100px" DataField="Ship ZIP/Postal Code"
                    HeaderText="Ship ZIP/Postal Code" SortExpression="Ship ZIP/Postal Code" UniqueName="Ship ZIP/Postal Code"
                    Mask="#####">
                    <FooterStyle Font-Bold="true" />
                </telerik:GridMaskedColumn>
                <telerik:GridNumericColumn HeaderStyle-Width="90px" FilterControlWidth="50px" DataField="Shipping Fee"
                    DataType="System.Decimal" HeaderText="Shipping Fee" SortExpression="Shipping Fee"
                    UniqueName="Shipping Fee" Aggregate="Sum">
                    <FooterStyle Font-Bold="true" />
                </telerik:GridNumericColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Scrolling AllowScroll="false" />
        </ClientSettings>
    </telerik:RadGrid>
   <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:MicrosoftAccess_v2007_Northwind %>"
        ProviderName="System.Data.OleDb" SelectCommand="SELECT * FROM Orders" runat="server">
    </asp:SqlDataSource>
    </form>
</body>
</html>

There's nothing in the code-behind file defaualt.aspx.cs. Problem I'm getting is that when I click on the paging or filtering, the AJAX request is served (I can see the telerik:RadAjaxLoadingPanel running), but it runs indefinitely and the data doesn't change. The data source itself is an Access 2007 file (Northwind 2007.accdb) located in the App_Data folder of the application.

I'm using "RadControls_for_ASP.NET_AJAX_2009_3_1103" on VS.Net 2010. The project where this Default.aspx page is set up is a "Telerik RadControls CSharp Web Application".

Thanks in advance for any help.

Sanjay.

Johny
Top achievements
Rank 1
 answered on 11 Jul 2016
4 answers
266 views

Hi. I would like to know how do i integrate asp:Repeater with telerik:RadPanelBar. my final outcome would be each row in the repeater is able to show and hide as the content of the repeater might cause the whole page to be very long

i receive the following error

Telerik.Web.UI.RadPanelItemCollection must have items of type 'Telerik.Web.UI.RadPanelItem'. 'ItemTemplate' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

my markup.

01.<asp:UpdatePanel ID="UpdatePanel2" runat="server">
02.    <ContentTemplate>
03.
04.         <asp:Repeater ID="Repeater2" runat="server">
05.
06.              <HeaderTemplate>
07.                  <telerik:RadPanelBar RenderMode="Lightweight" runat="server" ID="RadPanelBar1" Width="750" Height="250"
08.                                        Skin="Telerik" ExpandMode="FullExpandedItem">
09.                                        <Items>
10.               </HeaderTemplate>
11.               <ItemTemplate>
12.                  <telerik:RadPanelItem Expanded="true" CssClass="top-offers">
13.                      <ContentTemplate>
14.                           <tr>
15.                              <td>
16.                                <asp:Label runat="server" ID="lblEntry">Entry Type <%# Container.ItemIndex+1 %></asp:Label>
17.                              </td>
18.                           </tr>
19.                           <tr>
20.                             <td>Entry Qualification</td>
21.                             <td>
22.                               <telerik:RadEditor ID="txtQualification" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "qualification") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
23.                                                        <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
24.                                                    </telerik:RadEditor>
25.                              </td>
26.                           </tr>
27.                           <tr>
28.                              <td>Academic Requirement</td>
29.                               <td>
30.                                  <telerik:RadEditor ID="txtRequirement" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "requirement") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
31.                                                        <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
32.                                                    </telerik:RadEditor>
33.                               </td>
34.                             </tr>
35.                            <tr>
36.                              <td>Relavant Working Experience</td>
37.                              <td>
38.                                 <telerik:RadEditor ID="txtExperience" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "experience") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
39.      <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
40.                                                    </telerik:RadEditor>
41.                              </td>
42.                          </tr>
43.                          <tr>
44.                            <td>
45.                              <asp:Button ID="btnRemoveCert" runat="server" Text="Remove Certificate"
46.                                                        CommandName="remove" CommandArgument='<%# Container.ItemIndex %>' />
47.                            </td>
48.                          </tr>
49.                          <tr>
50.                             <td colspan="2"><hr /></td>
51.                         </tr>
52.                 </ContentTemplate>
53.            </telerik:RadPanelItem>
54.         </ItemTemplate>
55.         <FooterTemplate>
56.                  <tr>
57.                    <td>
58.                      <asp:Button ID="btnAddEntry" runat="server" Text="Add Entry" OnClick="btnAddEntry_Click" />
59.                     </td>
60.                  </tr>
61.                  </Items>
62.              </telerik:RadPanelBar>
63.        </FooterTemplate>
64.     </asp:Repeater>
65.
66.  </ContentTemplate>
67.</asp:UpdatePanel>

Veselin Tsvetanov
Telerik team
 answered on 11 Jul 2016
1 answer
100 views

I've hooked up RadGrid to an EntityDataSource control. It shows data fine, but won't update. Here is how I have the data source control setup:

<ef:EntityDataSource ID="EntityDataSource1" runat="server" EntitySetName="Events" DefaultContainerName="" EnableInsert="True" EnableUpdate="True" ContextTypeName="DataAccess.SurveyContext" EnableFlattening="False" AutoPage="False" AutoSort="False" EnableViewState="True"></ef:EntityDataSource>

Any ideas why update won't work?

David McCarter

 

 

 

Viktor Tachev
Telerik team
 answered on 11 Jul 2016
1 answer
164 views

I've got a Grid which holds quite a few columns of information.The first column of each row is a button with a unique ID that, when clicked, expands the DetailTables with relevant information to the row. The button executes the following command: CommandName="expandCollapse" .

 

How can I make it so that whenever I click a row it would expand the DetailTables? Any help would be much appreciated. 

Viktor Tachev
Telerik team
 answered on 11 Jul 2016
2 answers
374 views

I have some code I'm troubleshooting from our offshore team.  We have a datagrid that we want to enable paging on, the problem is that the CurrentPageIndex of the RadGrid is always 0.  We aren't using a DataSource property but retrieving our data via a service layer in the code-behind that calls a stored proc that uses OFFSET and FETCH to return the subset of rows based on the page index and page size.

Here's the ASPX code for the RadGrid:

<telerik:RadGrid ID="EnrollmentPeriodCompanyElectionsGrid" runat="server" AllowSorting="true" AutoGenerateColumns="false" PageSize="20" AllowPaging="True" AllowCustomPaging="true" OnPageIndexChanged="EnrollmentPeriodCompanyElectionsGrid_PageIndexChanged"
    OnPageSizeChanged="EnrollmentPeriodCompanyElectionsGrid_PageSizeChanged" OnNeedDataSource="EnrollmentPeriodCompanyElectionsGrid_NeedDataSource" OnItemDataBound="EnrollmentPeriodCompanyElectionsGrid_ItemDataBound" EnableViewState="true">
 
    <MasterTableView NoMasterRecordsText="Nothing was found for this election period">
        <Columns>
            <telerik:GridBoundColumn DataField="HrpClientID" HeaderText="ID" SortExpression="HrpClientID" />
            <telerik:GridHyperLinkColumn HeaderText="COMPANY" UniqueName="Company" SortExpression="CompanyName" DataTextField="CompanyName" DataNavigateUrlFields="CompanyID,BenefitEnrollmentPeriodID" DataNavigateUrlFormatString="~/Admin/Companies/Company.aspx?companyID={0}&page=Exhibits&periodID={1}"
                HeaderStyle-Width="300px" />
            <telerik:GridBoundColumn DataField="CompanyType" HeaderText="TYPE" SortExpression="CompanyType" />
            <telerik:GridBoundColumn DataField="HRP" HeaderText="HRP" SortExpression="HRP" />
            <telerik:GridBoundColumn DataField="HRC" HeaderText="HRC" SortExpression="HRC" />
            <telerik:GridBoundColumn DataField="EnrollmentStatus" SortExpression="EnrollmentStatus" HeaderText="STATUS" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Here's the NeedDataSource method:

protected void EnrollmentPeriodCompanyElectionsGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                var enrollmentId = Request.QueryString["PeriodID"] != null ? int.Parse(Request.QueryString["PeriodID"]) : 0;
                {
                    RadGrid enrollmentPeriodCompanyElectionsGrid = (RadGrid)sender;
 
                    int currentPageIndex = EnrollmentPeriodCompanyElectionsGrid.CurrentPageIndex;
                    var dataSource = GetBenefitEnrollmentCompanies(enrollmentId, currentPageIndex, pageSize);
 
                    enrollmentPeriodCompanyElectionsGrid.DataSource = dataSource.BenefitEnrollmentCompanyDetail;
 
                    // set this only once.
                    if (enrollmentPeriodCompanyElectionsGrid.VirtualItemCount == 0)
                        enrollmentPeriodCompanyElectionsGrid.VirtualItemCount = dataSource.TotalRecordsCount;
                }
 
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleError<Exception>(ex, new { UserID = CurrentUser.UserID, CompanyID = CurrentCompany.CompanyID, ViewingUserID = CurrentUser.UserID, PageIndex = 1, PageSize = pageSize });
            }
        }

and PageIndexChanged:

protected void EnrollmentPeriodCompanyElectionsGrid_PageIndexChanged(object sender, GridPageChangedEventArgs e)
    {
        try
        {
            // reset this property to new page after.
            EnrollmentPeriodCompanyElectionsGrid.CurrentPageIndex = e.NewPageIndex + 1;
        }
        catch (Exception ex)
        {
            ErrorHandler.HandleError<Exception>(ex, new { UserID = CurrentUser.UserID, CompanyID = CurrentCompany.CompanyID, ViewingUserID = CurrentUser.UserID, PageIndex = e.NewPageIndex, PageSize = pageSize });
        }
    }

However, no matter what the CurrentPageIndex is 0.  I've verified by manually changing the CurrentPageIndex in Visual Studio that, when set, paging works correctly, it just is always being set to 0.  I've tried everything, but I can't get the paging to recognize that I'm selecting a new page.

Kostadin
Telerik team
 answered on 11 Jul 2016
4 answers
51 views

I have a DDT binding server side to Id & Name, I also have checkboxes

rdtLocation.DataSource = locations;
rdtLocation.DataTextField = "Name";
rdtLocation.DataFieldID = "Id";
rdtLocation.DataValueField = "Id";
rdtLocation.DataFieldParentID = "ParentId";
rdtLocation.DataSource = locations;
rdtLocation.DataBind();

With one selected item when I look at the selectedValue I get a comma separated list containing 2 instances of the id. ie - "2,2"

See attached screen shot.

Why is this and what is the fix.

Andy

Eyup
Telerik team
 answered on 11 Jul 2016
1 answer
164 views

Hi there,

I need to show next and prev button above rad grid so that when my site is open on mobile view, user can navigate to rest of the columns. Every column is given fixed width. But the issue I am facing that I must have to freeze at least one column.

Current code:

<MasterTableView DataKeyNames="UserID" HeaderStyle-Width="100px" TableLayout="Auto" CommandItemDisplay="TopAndBottom" CommandItemSettings-ShowAddNewRecordButton="false" CommandItemSettings-ShowRefreshButton="false" CommandItemSettings-NextFrozenColumnText="Next Column" CommandItemSettings-PrevFrozenColumnText="Previous Column">

 <ClientSettings>
         <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="1" EnableNextPrevFrozenColumns="true" />
 </ClientSettings>

When I set FrozenColumnsCount="0", next and prev button stop working.

Kindly provide the solution so that no column would get freezed.

 

Viktor Tachev
Telerik team
 answered on 11 Jul 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?