Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
291 views
When using iif to handle dividing by zero in my calculated column I am always getting 0.

 <telerik:GridCalculatedColumn DataFields="Pagecount, Teampagecount" Expression="iif({1}=0,0,{0}/{1}*100)" HeaderText="Team Work Ratio" UniqueName="Teamratio" DataType="System.Decimal" ItemStyle-HorizontalAlign="Right" /> 

when I uses the expression iif({1},0,{0}) the column displays the value in the bound column Pagecount and if I use the expression iif({1},0,{1}) the column displays the value in the bound column Teampagecount, but when I put the 2 together I always get 0.

What could be the problem? 

Here is the entire grid

<telerik:RadGrid ID="rgWorkload" runat="server" Skin="Sunset" Width="998px" Height="500px" 
AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" GridLines="None" 
PageSize="50" AutoGenerateColumns="False" ShowFooter="true"
<MasterTableView AllowMultiColumnSorting="true"
<FooterStyle Height="20px" /> 
<Columns> 
<telerik:GridBoundColumn DataField="User" HeaderText="Underwriter" UniqueName="User" 
DataType="System.String" Aggregate="Count" /> 
<telerik:GridBoundColumn DataField="Teamname" HeaderText="Primary Team" UniqueName="Teamname" 
DataType="System.Int32" /> 
<telerik:GridBoundColumn DataField="Mas" HeaderText="MAS" UniqueName="Mas" DataType="System.String" /> 
<telerik:GridBoundColumn DataField="Casecount" HeaderText="Pending Cases" UniqueName="Casecount" 
DataType="System.Int32" ItemStyle-HorizontalAlign="Right" Aggregate="Sum" /> 
<telerik:GridBoundColumn DataField="Doccount" HeaderText="Pending Documents" UniqueName="Doccount" DataType="System.Int32" ItemStyle-HorizontalAlign="Right" Aggregate="Sum" /> 
<telerik:GridBoundColumn DataField="Pagecount" HeaderText="Pending Pages" UniqueName="Pagecount" 
DataType="System.Int32" ItemStyle-HorizontalAlign="Right" Aggregate="Sum" /> 
<telerik:GridBoundColumn DataField="Dupcount" HeaderText="Cases with Possible Dups" 
UniqueName="Dupcount" DataType="System.Int32" ItemStyle-HorizontalAlign="Right" 
Aggregate="Sum" /> 
<telerik:GridCalculatedColumn DataFields="Pagecount, Teampagecount" Expression="iif({1}=0,0,{0}/{1}*100)" 
HeaderText="Team Work Ratio" UniqueName="Teamratio" DataType="System.Decimal" 
ItemStyle-HorizontalAlign="Right" Aggregate="Avg" FooterAggregateFormatString="Mean: {0:0.00}" /> 
<telerik:GridCalculatedColumn DataFields="Pagecount, Overallpagecount" Expression="iif({1}=0,0,{0}/{1}*100)" 
HeaderText="Overall Work Ratio" UniqueName="Overallratio" DataType="System.Decimal" 
ItemStyle-HorizontalAlign="Right" Aggregate="Avg" FooterAggregateFormatString="Mean: {0:0.00}" /> 
<telerik:GridBoundColumn DataField="Compcasecount" HeaderText="Completed Cases(24hrs)" 
UniqueName="Compcasecount" DataType="System.Int32" ItemStyle-HorizontalAlign="Right" 
Aggregate="Sum" /> 
<telerik:GridBoundColumn DataField="Teampagecount" HeaderText="Team Pages" UniqueName="Teampagecount" 
DataType="System.Int32" ItemStyle-HorizontalAlign="Right" /> 
<telerik:GridBoundColumn DataField="Overallpagecount" HeaderText="Overall Pages" UniqueName="Overallpagecount" 
DataType="System.Int32" ItemStyle-HorizontalAlign="Right" /> 
</Columns> 
</MasterTableView> 
<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True"
<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" /> 
<Resizing AllowColumnResize="true" EnableRealTimeResize="true" ClipCellContentOnResize="false" /> 
</ClientSettings> 
</telerik:RadGrid> 



Kostadin
Telerik team
 answered on 21 Aug 2015
2 answers
256 views

Is there a way to keep the DropdownTree open at all times - i dont not want to have it close when i click somewhere else on the page.  I have it open on load now.

I'm trying to have a user click on the node and have that node text populate in a textbox where the user can update the text.  Everytime i click on the textbox the tree closes.  Thanks :)

   <telerik:RadDropDowntree ID="RadDropDownTest"      TextMode="FullPath" ExpandNodeOnSingleClick="true"
                        OnClientEntryAdding="OnClientEntryAdding" OnClientEntryAdded="OnClientEntryAdded" OnClientEntryRemoved="OnClientEntryRemoved"  Skin="Office2007" runat="server" Width="450px"  DropDownSettings-Height="200px" DefaultMessage="Select Rubric Description"
                                >
                            <DropDownSettings Width="450px" OpenDropDownOnLoad="true"   CloseDropDownOnSelection="false" />
                            <ButtonSettings ShowCheckAll="false" ShowClear="true" />
                                <Localization Clear="Clear All" />
                                               
                        </telerik:RadDropDowntree>​

derek
Top achievements
Rank 2
 answered on 21 Aug 2015
5 answers
347 views
I have a RadGrid with GridCalculatedColumn when rebind...

An item with the same key has already been added.

I'm running 2013.3.1015.45.

ASPX

<telerik:RadGrid ID="grillaAfectos" runat="server" AllowPaging="True" AllowSorting="True"
GridLines="None" AutoGenerateColumns="true" PageSize="10"  EnableLinqExpressions="false"
Skin="Metro" Visible="true" Width="98%" OnNeedDataSource="grillaAfectos_NeedDataSource" OnItemDataBound="grillaAfectos_ItemDataBound">
<MasterTableView AutoGenerateColumns="False" AllowCustomPaging="true" NoMasterRecordsText="No se encontraron registros para mostrar.">
<Columns>
<telerik:GridBoundColumn HeaderText="Cuenta Contable" DataField="Detalle.NumeroCuenta"  HeaderStyle-Width="20%">
</telerik:GridBoundColumn>                                                                                   
<telerik:GridCalculatedColumn HeaderText="Descripcion" DataType="System.String" DataFields="Proveedor.ProveedorID, Detalle.CodigoDocumentoPago.Codigo, Detalle.NumeroDocumento, Detalle.FechaMovimiento.Date" Expression='{0} + " " + {1} + "/" + {2} + " " + {3}'>
</telerik:GridCalculatedColumn>
<telerik:GridBoundColumn HeaderText="Monto" DataField="Total" DataFormatString="{0:C0}" ItemStyle-HorizontalAlign="Right" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Nuevo Monto" DataField="MontoNuevo" DataFormatString="{0:C0}" ItemStyle-HorizontalAlign="Right" >
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderStyle-Width="20px" FilterControlAltText="Filter TemplateColumn column" HeaderText="Acción" UniqueName="TemplateColumn" ItemStyle-HorizontalAlign="Center" >
<%--<ItemTemplate>
<asp:HyperLink ID="lnkEditar" runat="server" ImageUrl="~/Content/Img/Grid/edit.png" BorderWidth="0px" BorderStyle="None" ToolTip="Editar" NavigateUrl=<%#"Javascript:onBtnActionsClick('ActualizarTasas.aspx?id=" + Eval("DocumentosPagadosID").ToString() + "&dolar=" + ViewState("dolar") + "','Tasas','Tasas',800,200)"%> Visible="false"/>
</ItemTemplate>--%>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="" DataField="FacturaDetalleID" Visible="false" >
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True">
</ClientSettings>
</telerik:RadGrid>

Code Behind
Dim grillaAfectos As RadGrid = DirectCast(RadPanelBar5.FindItemByValue("Desembolsos").FindControl("grillaAfectos"), RadGrid)
grillaAfectos.DataSource = objNotaDebito.Tasas
          grillaAfectos.DataBind()
Protected Sub grillaAfectos_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs)
            objNotaDebito = DirectCast(objCache("NotaDebito"), NotaDebitoVO)
            Dim grillaAfectos As RadGrid = DirectCast(RadPanelBar5.FindItemByValue("Desembolsos").FindControl("grillaAfectos"), RadGrid)
            Dim startIndex As Int32 = grillaAfectos.CurrentPageIndex
            Dim maximumRows As Int32 = grillaAfectos.PageSize
            If objNotaDebito.Tasas IsNot Nothing AndAlso objNotaDebito.Tasas.Count > 0 Then
                objNotaDebito.Tasas = objNotaDebito.Tasas.Skip((startIndex) * maximumRows).Take(maximumRows).ToList()
            End If
 
            grillaAfectos.DataSource = objNotaDebito.Tasas
        End Sub


If I remove this column works perfectly....
Maria Ilieva
Telerik team
 answered on 21 Aug 2015
1 answer
805 views

I want to add custom attributes to model fields.

Think can I add data-email-msg as attribute to a field in Kendo Grid.(Please look at my example and how I add it..)

here is a example.....

$("#grid").kendoGrid({

     columns: [

              { field: "name",

                title: "Name",

               attributes: {

                        "class": "table-cell",

                         style: "text-align: right; font-size: 14px",

                         data-email-msg : "enter a valid email massage" } } ],

      dataSource: [ { name: "Jane Doe" }, { name: "John Doe" }] }); 

 

I already know that above is wrong. I am asking, is there a way to do that ??
Viktor Tachev
Telerik team
 answered on 21 Aug 2015
2 answers
206 views

I need to make my application in such a way that there would be a centralized configurable dateformat for the whole application.
I would store the applicable dateformats in an xml file or a database & the selected dateformat will also be stored.
If for example the user has selected dd/MM/yyyy as the default format, Then every page,user control would display the datepickers,grids,form fields that are datetime in dd/MM/yyyy format throughout the application.
Can you give me a possible solution or approach I should use to achieve this?
Any suggestions of doing it in a generic way so that I dont have to configure it on every page/control/usercontrol(grid, datepicker etc).

Can this be achieved through globalization feature of Telerik UI ? Some demo or documentation would be great.

 

Zepp
Top achievements
Rank 1
 answered on 21 Aug 2015
3 answers
227 views

We're using one version back from the latest telerik release and the grid setup is pretty straight-forward.

 There is one detail grid for each row and each column on both the master and detail grids are template columns who have their values displayed with calls to Eval().

If InsertItemDisplay="top" everything looks fine, however InsertItemDisplay="bottom" causes the grid to render as in the attached screenshots.

Notice in the second screenshot the insert row looks fine on the detail grid which makes me think it's an issue with the expand indicator column on the master grid.

Can anyone else reproduce this?

 

Viktor Tachev
Telerik team
 answered on 21 Aug 2015
13 answers
681 views
Version: 2011.1.519.35
Screenshot: IE9 (repro'd in FF6 and Chrome)
I've customized the AJAX Radscheduler to display MonthView only, limiting the number of visible appointments to one per day.  Here is my scheduler markup:
<telerik:RadScheduler runat="server" CssClass="DPScheduler" OverflowBehavior="Scroll" ID="rsCalendarEventScheduler" Skin="Windows7"
DataKeyField="dp_calendar_event_id"
DataStartField="start"
DataEndField="end"
DataSubjectField="subject"
Height="335px"
MonthView-AdaptiveRowHeight="false"
ShowFooter="false"
ReadOnly="true" ShowViewTabs="false"
TimeSlotContextMenuSettings-EnableDefault="false"
FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" OnNavigationComplete="rsCalendarEventScheduler_NavigationComplete"
EnableDescriptionField="true"
MonthView-VisibleAppointmentsPerDay="1"
SelectedView="MonthView"
OnTimeSlotCreated="rsCalendarEventScheduler_TimeSlotCreated"
AppointmentStyleMode="Default"
MonthView-HeaderDateFormat="MMMM yyyy">
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <AppointmentContextMenuSettings EnableDefault="true" />
    <AppointmentTemplate/>                                                                         
</telerik:RadScheduler>

I've attached a screenshot of what happens.  Notice how when the week "wraps", more than the required number of multi-day appointments start appearing per day.

Thanks,
Eric
Nencho
Telerik team
 answered on 21 Aug 2015
1 answer
122 views

I want to manipulate edittemplate controls from a radgrid from a textchanged event 

I cannot figure out how to define the textbox and labels outside of a gridevent.  

Does anyone have an example?  

Viktor Tachev
Telerik team
 answered on 21 Aug 2015
11 answers
467 views
How do you clear the image from the Image Edit? For example, I have the ImageEdit on a RadWindow to allow uploading/cropping an image. If I click 'select' choose an image and click 'upload' and then close the rad window that image is still there. How do I make that a 'new' ImageEditor when the button is clicked again to open the RadWindow?
Vessy
Telerik team
 answered on 21 Aug 2015
1 answer
91 views

 

Hi,

    Create RadDockZone,RadDock dynamically .And in this RadDock inside we can show the rad chart  dynamically please help me 

Vessy
Telerik team
 answered on 21 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?