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

Hi,

Filters for edit form template is not working in Telerik RadGrid. I followed the below link for the development, but filters are not working .

https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/edit-form-types/defaultcs.aspx

 

Eyup
Telerik team
 answered on 26 Apr 2018
6 answers
233 views
Hi Telerik Team,

I am facing column alignment issue while exporting the generated RadGrid to Excel/Word. I am using relative width to align the UI (please refer to sample code below and attached 'UI_View.png' file), however when exported to Word/Excel the alignment is getting displaced, detail table columns are not following the master table columns (refer to 'Excel_Export.png' and 'Word_Export.png' files).

Would appreciate if you could come up with an idea on to keep the alignment intact so detail table columns are exactly in the same column of master table when exported.

Thanks,

Pankaj

<telerik:RadGrid ID="rgDTSItems" EnableAJAX="True" EnableAJAXLoadingTemplate="True"
               Skin="Windows7" OnColumnCreated="rgDTSItems_ColumnCreated" OnItemCreated="rgDTSItems_ItemCreated"
               OnItemDataBound="rgDTSItems_ItemDataBound" ShowStatusBar="true" runat="server"
               Width="99.9%" PageSize="10" AllowSorting="True" AllowMultiRowSelection="false"
               AllowPaging="True" GridLines="Horizontal" AutoGenerateColumns="False" OnDetailTableDataBind="rgDTSItems_DetailTableDataBind"
               OnNeedDataSource="rgDTSItems_NeedDataSource" OnItemCommand="rgDTSItems_ItemCommand">
               <GroupPanel Visible="False">
               </GroupPanel>
               <ClientSettings Selecting-AllowRowSelect="true" EnableRowHoverStyle="true">
               </ClientSettings>
               <MasterTableView HierarchyLoadMode="Client" DataKeyNames="RefNo,DeptDiv" DataMember="mcs_main"
                   ShowHeader="true" TableLayout="Fixed" Width="100%" CommandItemDisplay="Bottom"
                   HorizontalAlign="Right">
                   <Columns>
                       <telerik:GridBoundColumn DataField="RefNo" Visible="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="DeptDiv" HeaderText="Div" HeaderStyle-Width="8%"
                           HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Ref No" SortExpression="RefNo"
                           HeaderStyle-Width="8%" HeaderStyle-Font-Bold="true">
                           <ItemTemplate>
                               <asp:Label ID="lblRefNo" runat="server" Text='<%#Eval("Type").ToString().Substring(0, 1) + "-" + Eval("RefNo")%>'>
                               </asp:Label>
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>
                       <telerik:GridBoundColumn DataField="DateDueDoc" UniqueName="DateDueDoc" Display="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn UniqueName="gtcDocDueDate" HeaderText="Due/Doc Date"
                           SortExpression="DateDueDoc" HeaderStyle-Width="12%" HeaderStyle-Font-Bold="true">
                           <ItemTemplate>
                               <asp:Label ID="lblDateDueDoc" runat="server" Text='<%#Eval("DateDueDoc","{0:d}") + " " + Eval("TimeDueDoc") %> '></asp:Label>
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>
                       <telerik:GridBoundColumn DataField="Sender" HeaderText="From" HeaderStyle-Width="15%"
                           HeaderStyle-Font-Bold="true">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Recipient" HeaderText="Assigned To/Recipient"
                           HeaderStyle-Width="25%" ItemStyle-Wrap="true" HeaderStyle-Font-Bold="true">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn UniqueName="gtcSubject" HeaderText="Subject" SortExpression="Subject"
                           HeaderStyle-Width="32%" HeaderStyle-Font-Bold="true">
                           <ItemTemplate>
                               <asp:Label ID="lblSubject" runat="server" Text='<%#Eval("FormattedSubject")%>' Font-Bold="true"></asp:Label>
                               <telerik:RadToolTip ID="rttSubject" runat="server" TargetControlID="lblSubject" Width="200px"
                                   RelativeTo="Element" Position="MiddleRight" EnableShadow="true">
                                   <%#Eval("Subject")%>
                               </telerik:RadToolTip>
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>
                   </Columns>
                   <DetailTables>
                       <telerik:GridTableView DataKeyNames="RefNo,DeptDiv" DataMember="mcs_main" ShowHeader="False"
                           EnableNoRecordsTemplate="false" Width="100%" ShowHeadersWhenNoRecords="false"
                           HorizontalAlign="Right" TableLayout="Fixed">
                           <Columns>
                               <telerik:GridBoundColumn DataField="RefNo" Visible="false">
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="DeptDiv" HeaderText="Div" HeaderStyle-Width="8%">
                               </telerik:GridBoundColumn>
                               <telerik:GridTemplateColumn UniqueName="gtcRefNo" HeaderText="Ref No" SortExpression="RefNo"
                                   HeaderStyle-Width="8%">
                                   <ItemTemplate>
                                       <asp:Label ID="lblRefNo" runat="server" Text='<%#Eval("Type").ToString().Substring(0, 1) + "-" + Eval("RefNo")%>'>
                                       </asp:Label>
                                   </ItemTemplate>
                               </telerik:GridTemplateColumn>
                               <telerik:GridBoundColumn DataField="DateDueDoc" UniqueName="DateDueDoc" Display="false">
                               </telerik:GridBoundColumn>
                               <telerik:GridTemplateColumn UniqueName="gtcDocDueDate" HeaderText="Due/Doc Date"
                                   SortExpression="DateDueDoc" HeaderStyle-Width="12%">
                                   <ItemTemplate>
                                       <asp:Label ID="lblDateDueDoc" runat="server" Text='<%#Eval("DateDueDoc","{0:d}") + " " + Eval("TimeDueDoc") %> '></asp:Label>
                                   </ItemTemplate>
                               </telerik:GridTemplateColumn>
                               <telerik:GridBoundColumn DataField="Sender" HeaderText="From" HeaderStyle-Width="15%">
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="Recipient" HeaderText="Assigned To/Recipient"
                                   HeaderStyle-Width="25%" ItemStyle-Wrap="true">
                               </telerik:GridBoundColumn>
                               <telerik:GridTemplateColumn UniqueName="gtcSubject" HeaderText="Subject" SortExpression="Subject"
                                   HeaderStyle-Width="32%" HeaderStyle-Font-Bold="true">
                                   <ItemTemplate>
                                       <asp:Label ID="lblSubject" runat="server" Text='<%#Eval("FormattedSubject")%>' Font-Bold="true"></asp:Label>
                                       <telerik:RadToolTip ID="rttSubject" runat="server" TargetControlID="lblSubject" Width="200px"
                                           RelativeTo="Element" Position="MiddleRight" EnableShadow="true">
                                           <%#Eval("Subject")%>
                                       </telerik:RadToolTip>
                                   </ItemTemplate>
                               </telerik:GridTemplateColumn>
                           </Columns>
                       </telerik:GridTableView>
                   </DetailTables>
                   <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true"
                       ShowExportToCsvButton="false" ShowExportToPdfButton="true" ShowAddNewRecordButton="false"
                       ShowRefreshButton="false" />
               </MasterTableView>
               <ClientSettings AllowExpandCollapse="true">
                   <DataBinding CountPropertyName="Count" />
                   <ClientEvents OnRowCreated="RowCreated" OnRowDblClick="RowDblClicked" />
               </ClientSettings>
               <ExportSettings HideStructureColumns="true" IgnorePaging="true" ExportOnlyData="true"
                   FileName="DTS_Items" OpenInNewWindow="true" Pdf-PageHeight="215mm" Pdf-PageWidth="356mm" />
               <FilterMenu EnableTheming="True" Skin="Outlook">
                   <CollapseAnimation Duration="200" Type="OutQuint" />
               </FilterMenu>
               <SelectedItemStyle CssClass="SelectedFolder"></SelectedItemStyle>
           </telerik:RadGrid>

protected void rgDTSItems_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)
        {
            ConfigureExport();
        }
        else if (e.CommandName == "Print")
        {
            ConfigureExport();
            ConfigurePrint();
        }
        else if (e.CommandName == "EnablePaging")
        {
            rgDTSItems.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
            rgDTSItems.MasterTableView.HierarchyDefaultExpanded = false;
            rgDTSItems.MasterTableView.DetailTables[0].GetColumn("DateDueDoc").Visible = true;
            EnableDisablePaging(true);
        }
    }
 
    private void ConfigureExport()
    {
        rgDTSItems.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerBind;
        rgDTSItems.MasterTableView.HierarchyDefaultExpanded = true;
        //Since while exporting hidden column DateDueDoc appears therefore hide the column before exporting
        rgDTSItems.MasterTableView.DetailTables[0].GetColumn("DateDueDoc").Visible = false;
 
    }
 
    //For printing we need to disable paging and call the PrintGird client function
    private void ConfigurePrint()
    {
        //Allowpaging to false
        EnableDisablePaging(false);
 
        foreach (GridItem item in rgDTSItems.MasterTableView.GetItems(new GridItemType[] { GridItemType.Pager, GridItemType.FilteringItem }))
            item.Display = false;
 
        ramHome.ResponseScripts.Add("PrintGrid('" + rgDTSItems.ClientID + "')");
    }
 
    //Enable/disable paging in case of Print
    private void EnableDisablePaging(bool doEnable)
    {
        rgDTSItems.AllowPaging = doEnable;
        rgDTSItems.Rebind();
    }

Maulik
Top achievements
Rank 1
 answered on 26 Apr 2018
0 answers
188 views
Hi, is there a way to remove or update the following table summary ="Data pager which controls on which page is the RadGrid control"? Looks like it is created in pager style.
Brad
Top achievements
Rank 1
 asked on 25 Apr 2018
0 answers
189 views

I am trying to get this functionality to work : 

https://docs.telerik.com/devtools/aspnet-ajax/controls/button/how-to/radbutton-validation-and-client-side-event-handlers

however it seems as though Page_ClientValidate (or Page_IsValid) is always returning true.   

Ultimately I need to be able to run different scripts depending on whether or not the page has errors. 

laura
Top achievements
Rank 1
 asked on 25 Apr 2018
1 answer
153 views

Hey

I am trying to set the padding for the DateInput.  I can set it using the following:

<telerik:RadDatePicker ID="RadExpDate" runat="server" RenderMode="Lightweight" Height="23px" ShowPopupOnFocus="true" DateInput-EmptyMessage="mm/dd/yyyy">

  <DateInput runat="server" EmptyMessageStyle-PaddingTop="2" EnabledStyle-PaddingTop="2" FocusedStyle-PaddingTop="2" ></DateInput>

</telerik:RadDatePicker>

Was wondering if the was a setting in CSS to set the padding once regardless of the state of the control (ie: Empty, Enable, etc)?

Thanks

Tom

Vessy
Telerik team
 answered on 25 Apr 2018
0 answers
132 views

I'm trying to create a RadGrid with ClientDatasource connected to a Webservice to get, update and delete data. I created everything like the example. Unfortunately the behaviour is very strange / inconsistent. The "Get" Mathot works fine. The "Add" method on the other hand seems to work only once or sometimes twice before reloading the page completely. The "Delete" and and "Edit" Method seem not to get triggered at all.

Its cannot be a problem of the Webservice since I can manually ( over http ) trigger all of the methods without a problem. Furthermore it seems that all the parameters passed to the WS get lost. Can anyone give me an advice on what I am doing wrong here?

Here is my code:

JS:

    <script type="text/javascript">
    //<![CDATA[
    function ParameterMap(sender, args) {
 
        if (args.get_type() != "read" ) {
            args.set_parameterFormat("{ 'parameterName': 'test' }");
        }
    }
 
    function UserAction(sender, args) {
        if (sender.get_batchEditingManager().hasChanges(sender.get_masterTableView()) &&
            !confirm("Any changes will be cleared. Are you sure you want to perform this action?")) {
            args.set_cancel(true);
        }
    }
    //]]>
</script>

 

ASPX:

<telerik:RadGrid runat="server" ID="RadGrid1" ClientDataSourceID="RadClientDataSource1"
      ResolvedRenderMode="Classic" AllowFilteringByColumn="true"
      FilterType="HeaderContext"
      EnableHeaderContextMenu="true"
      EnableHeaderContextFilterMenu="true"
      PagerStyle-AlwaysVisible="true"
      AllowSorting="true" AllowPaging="True" CellSpacing="-1" GridLines="Both">
      <MasterTableView DataKeyNames="associationid" EditMode="Batch" CommandItemDisplay="Top" BatchEditingSettings-HighlightDeletedRows="true">
          <Columns>
              <telerik:GridBoundColumn DataField="associationid" HeaderText="associationid" UniqueName="column">
              </telerik:GridBoundColumn>
              <telerik:GridBoundColumn DataField="objectida" HeaderText="objectida" UniqueName="column1">
              </telerik:GridBoundColumn>
              <telerik:GridBoundColumn DataField="objectidb" HeaderText="objectidb" UniqueName="column2">
              </telerik:GridBoundColumn>
              <telerik:GridBoundColumn DataField="objectnamea" HeaderText="objectnamea" UniqueName="column3">
              </telerik:GridBoundColumn>
              <telerik:GridBoundColumn DataField="objectnameb" HeaderText="objectnameb" UniqueName="column4">
              </telerik:GridBoundColumn>
              <telerik:GridClientDeleteColumn HeaderText="Delete">
                  <HeaderStyle Width="70px" />
              </telerik:GridClientDeleteColumn>
          </Columns>
      </MasterTableView>
      <ClientSettings>
          <ClientEvents OnUserAction="UserAction" />
      </ClientSettings>
       
  </telerik:RadGrid>
 
      <telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="True" >
      <ClientEvents OnCustomParameter="ParameterMap"  />
      <DataSource >
          <WebServiceDataSourceSettings BaseUrl="http://localhost/DataService/DataService.svc/" ServiceType="Default">
              <Select Url="GetAssocs" DataType="JSON" />
              <Update Url="UpdateAssoc" DataType="JSON" />
              <Insert Url="AddAssoc" DataType="JSON" />
              <Delete Url="DeleteAssoc" DataType="JSON" />
          </WebServiceDataSourceSettings>
      </DataSource>
 
      <Schema>
          <Model ID="associationid">
              <telerik:ClientDataSourceModelField FieldName="associationid" DataType="String" />
              <telerik:ClientDataSourceModelField FieldName="objectida" DataType="String" />
              <telerik:ClientDataSourceModelField FieldName="objectidb" DataType="String" />
              <telerik:ClientDataSourceModelField FieldName="objectnamea" DataType="String" />
              <telerik:ClientDataSourceModelField FieldName="objectnameb" DataType="String" />
          </Model>
      </Schema>
 
  </telerik:RadClientDataSource>

 

Webservice:

[ServiceKnownType(typeof(Association))]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class DataService : IDataService
{
    [WebGet]
    public List<Association> GetAssocs()
    {
        using (EventLog eventLog = new EventLog("Application"))
        {
            eventLog.Source = "Application";
            eventLog.WriteEntry("Log message GET", EventLogEntryType.Information, 101, 1);
        }
 
        List<Association> x = new List<Association>();
 
        for (int i = 0; i < 10; i++)
        {
            Association a = new Association();
 
            a.associationid = i.ToString();
            a.objectida = i.ToString();
            a.objectidb = i.ToString();
            a.objectnamea = i.ToString();
            a.objectnameb = i.ToString();
 
            x.Add(a);
        }
 
        return x;
 
    }
    [WebGet]
    public void UpdateAssoc(string JSONstring)
    {
        try
        {
            using (EventLog eventLog = new EventLog("Application"))
            {
                eventLog.Source = "Application";
                eventLog.WriteEntry("Log " + JSONstring.ToString(), EventLogEntryType.Information, 101, 1);
            }
        }
        catch (Exception ex)
        {
 
            throw ex;
        }
 
    
    }
 
    [WebGet]
    public void AddAssoc(string JSONstring)
    {
 
        using (EventLog eventLog = new EventLog("Application"))
        {
            eventLog.Source = "Application";
            eventLog.WriteEntry("Log message ADD", EventLogEntryType.Information, 101, 1);
        }
 
    }
 
    [WebGet]
    public void DeleteAssoc(string JSONstring)
    {
 
        using (EventLog eventLog = new EventLog("Application"))
        {
            eventLog.Source = "Application";
            eventLog.WriteEntry("Log message DELETE", EventLogEntryType.Information, 101, 1);
        }
 
    }
 
}

 

and

[ServiceContract]
  public interface IDataService
  {
      [OperationContract]
      [WebGet]
      List<Association> GetAssocs();
 
      [OperationContract]
      [WebGet]
      void UpdateAssoc(string JSONstring);
 
      [OperationContract]
      [WebGet]
      void AddAssoc(string JSONstring);
 
      [OperationContract]
      [WebGet]
      void DeleteAssoc(string JSONstring);
  }
 
 
  [DataContract]
  public class Association
  {
 
      [DataMember]
      public string associationid { get; set; }
 
      [DataMember]
      public string objectida { get; set; }
 
      [DataMember]
      public string objectidb { get; set; }
 
      [DataMember]
      public string objectnamea { get; set; }
 
      [DataMember]
      public string objectnameb { get; set; }
 
 
  }

 

 

 

 

Manuel
Top achievements
Rank 1
 asked on 25 Apr 2018
0 answers
136 views

Hi All,

I am using Telerik Datetime picker in my ASP.net web application, but In C# while selecting the date from the control, I am loosing the datetime offset value and fraction of second value.

Please help.

Thanks,

S2

Santosh
Top achievements
Rank 1
 asked on 24 Apr 2018
0 answers
320 views

I know this has been asked multiple times, but i still cannot set the initial page of Kendo Grid

 

@(Html.Kendo().Grid<TherapistViewModel>()
.Name("KendoTherapistGrid")
.AutoBind(false)
.Columns(columns =>
{
 ---BOUND COLUMNS---
 
 })
.Events(e=>e.DataBound("onRowBound"))
.Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
.Filterable()
.Sortable()
.DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(20)
    .Model(model => model.Id(p => p.TherapistId))
.Read(read => read.Action("GetTherapistdata", "Therapist").Data("PatientDetails")) ) )

 

Since AutoBind if false, I am calling ReadDataSource when the document is ready

$(document).ready(function () {
     ReadDataSource();
});
 
function ReadDataSource()
{
     $("#KendoTherapistGrid").data().kendoGrid.dataSource.page(2);
}

 

I am hard-coding the page number for now until I get can it to work.  There are three pages in the grid.

Trey
Top achievements
Rank 2
 asked on 24 Apr 2018
0 answers
138 views

We have a lightweight tabstrip using the "Simple" skin. We'd like to call attention to a single tab by giving it a different color via a style. We're able to change it by using "tab1.backcolor=Color.Lime" but would prefer if we can have the tab have a secondary style so we can control it's parameters via css.

We tried the following and it successfully changes the single tab font-weight but the background color gets overwritten by the Simple skin:

tab1.CssClass = "highlight-tab";

html .highlight-tab {
    font-weight: bold !important;
    background-color: Lime !important;

}

We also the following to try and supplement the RadTabStrip_Simple style but can't figure out how to get it to work:

.RadTabStrip_Simple highlight-tab .rtsLevel1 .rtsLink

Is there a way to do this?

thanks

 

Jeff
Top achievements
Rank 1
 asked on 24 Apr 2018
1 answer
114 views

Hello,

Is there a way to get the index of the series item hovered via client - not just the Yvalue or category value? 

Was looking at the demo code...

function OnSeriesHover(args) {
                var message = $get("message");
                message.innerHTML = "Hover item with value '" + args.value + "' from category '" + args.category + "'.";
            }
Jason
Top achievements
Rank 1
 answered on 24 Apr 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?