Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
110 views
Hi,
I have a combobox bound to a webservice, if I enter "1-" then the following filtered results are shows  "1-a" & "1-b".
"1-a" is ticked, then a search value of  "2-" is entered.
 "2-a" is ticked.
After closing the combobox "1-a" is no longer selected.

It appears that the combo box loses it checked items that are no longer displayed in the filtered results.
Is their any way around this?

         <telerik:RadComboBox ID="RadComboBox1" Runat="server" Width="98%"
                    CheckBoxes="True" Filter="Contains" EnableEmbeddedSkins="true" EnableLoadOnDemand="true" >
                    <WebServiceSettings Path="webservices/MainSearch.asmx" Method="Rooms" />
                </telerik:RadComboBox>

Brian Taylor
Top achievements
Rank 1
 answered on 23 Aug 2011
3 answers
186 views
How do I set a textbox that has been assigned to a NumericTextBoxSetting control to accept real numbers. ie: a number with any number of decimal places.

The
DecimalDigits
property allows the setting to be 0 up to 99. This is not what I need.  What if my user enters a number with 600 decimal places?

Here is my code.

TextBox tbFloat = new TextBox();
string fID = ID + "Value" + i2;
tbFloat.ID = fID;
tbFloat.Attributes.Add("name", fID);
tbFloat.Text = Value;
c2.Controls.Add(tbFloat);
  
Telerik.Web.UI.NumericTextBoxSetting radF = new Telerik.Web.UI.NumericTextBoxSetting();
radF.EmptyMessage = "";
//radF.DecimalDigits = ? ;

radF.Type = Telerik.Web.UI.NumericType.Number;
radF.Validation.IsRequired = false;
  
TargetInput fi = new TargetInput();
fi.ControlID = fID;
radF.TargetControls.Add(fi);
  
RadInputManager1.InputSettings.Add(radF);

In the code above I have commented out the DecimalDigits line. Running this I get a textbox that accepts real numbers just fine, but always round them down to 2 decimal places! Huh?

I need one that accepts numbers of any number of decimal places.

I even tried this...

radF.DecimalDigits = -1 ;

But that of course does not work (would have been nice if it did) :)

Any clues on this one please?

Thanks

Brad









Vasil
Telerik team
 answered on 23 Aug 2011
1 answer
82 views
I want to start my grids out with no data, but I want to show the filter row ,so the user can use it as a search.

After they apply the filter the grid will populate.

Is this possible?
Pavlina
Telerik team
 answered on 23 Aug 2011
3 answers
283 views
HI,
I have fixed first column as default Group Item in GroupByExpressions and user can sort data but can not delete this group but problem is i want to disable close image from this header only. Rest columns if user will group then he can delete those columns from group header.
FYK " I have tried 
If (expression.GroupByFields(0).FieldName = "EngNameWithID") Then
     radGrdEngagments.GroupingSettings.ShowUnGroupButton = False
Else
     radGrdEngagments.GroupingSettings.ShowUnGroupButton = True
End If

But it's shows/removes close button for all items of group panel.
For more information see the image in Attachment.

Thanks.........
Rajneesh
Top achievements
Rank 2
 answered on 23 Aug 2011
4 answers
938 views
Hi Team,
I have a radgrid with some TemplateColumns in it.
Two such template columns have Raddatepicket in EditItemTemplate.
I want to find those two raddatepickers (which are in two different columns) and fire the Selected Datechanged client side event.
How can I do this??
Please help..

Regards,
Lok..
Princy
Top achievements
Rank 2
 answered on 23 Aug 2011
1 answer
194 views
How do I pass the retrieved extra values from my Upload dialog to my Custom content provider's StoreFile method? I see there is a string[] arguments parameter but how do I set this value?
protected void RadFileExplorer1_ItemCommand(object sender, Telerik.Web.UI.RadFileExplorerEventArgs e)
{
    if (e.Command == "UploadFile")
    {
        Telerik.Web.UI.RadFileExplorer explorer = sender as Telerik.Web.UI.RadFileExplorer;
        Telerik.Web.UI.RadUpload upload = explorer.Upload;
  
        //e.Path holds the file path
        string name = e.Path.Split(new char[] { '/' }).Last(); // get the filename including extension ;
  
        foreach (Telerik.Web.UI.UploadedFile uploadedFile in upload.UploadedFiles)
        {
            if (name.Equals(uploadedFile.GetName()))
            {
                string fileName = uploadedFile.GetName();
                string imageSize = uploadedFile.GetFieldValue("imageSize");
  
                // would like to pass imageSize to StoreFile method...
                  
                break;
            }
              
        }
    }
}

Dobromir
Telerik team
 answered on 23 Aug 2011
3 answers
117 views
HI,

I want to use export data to excel of radGrid.
But My radGrid is showing only 5 columns from a DB table. I want export all columns of that table.
is that possible?

I dont want to show all the columns in radGrid.
Jayesh Goyani
Top achievements
Rank 2
 answered on 23 Aug 2011
2 answers
174 views
Hi All,

I have RadGrid with TemplateColumns, one of the cloumns has a RadComboBox in the edititemtemplate and insertitemtemplate
and in the other i have RadDatePicker in the edititemtemplate and insertitemtemplate also...

in the edit or insert mode and on the selection of the RadComboBox i need to make the other templatecolumn unvisible (the corresponding column header and the RadDatePicker).

i did this using the selectIndexedChanged of the ComboBox and to get this column and set its readonly property to true. and all works fine but i noticed that i need to rebind the Grid so the corresponding column disappear...but this causes that the selection of the Radcombobox to be unselected also since all the grid is rebinded!!!

how can i keep the selection or shall i do it in another way???

attached screen shots of my problem
hope you can help as soon as possible...

Many Thanks
Asa'ad....


Veli
Telerik team
 answered on 23 Aug 2011
1 answer
81 views
I currently have a couple of grids that have some dropdowns as filters.  When I choose a filter where the data is only on page 2 of the grid the grid return 'No Data in Grid' but when I page over to page 2 the data is filtered correctly.  This is happening for both of my grids. 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkQueue.aspx.cs" Inherits="Sterling.SNEF.Tax.Web.WorkQueue" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>Work Queue</title>
    <style type="text/css">
        .RadGrid_Web20 .rgCommandRow
        {
            color: #35467C !important;
            height: 24px !important;
        }
    </style>
</head>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
    <script type="text/javascript">      
  
        function pageLoad(sender, eventArgs) {
            if (!eventArgs.get_isPartialLoad()) {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("InitialPageLoad");
            }
        
  
  
        function onRequestStart(sender, args)
        {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >=0)
            {
                args.set_enableAjax(false);
            }
        }
     
    </script>
  
</telerik:RadCodeBlock>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <ClientEvents OnRequestStart="onRequestStart" />
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="LoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>                        
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="LoadingPanel" runat="server" HorizontalAlign="Center"
        Width="50px" BorderColor="#99CCFF">
        <asp:Image ID="Image1" runat="server" ImageUrl="Images/loading.gif" ImageAlign="Top">
        </asp:Image>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Web20">
    </telerik:RadAjaxLoadingPanel>    
    <asp:Panel ID="Panel1" runat="server">
        <asp:Panel ID="Panel2" Visible="false" runat="server">
            <div style="border: thin solid #666666; left: 5px; position: relative; 
                left: 5px; width: 900px; border-collapse: collapse; background-color: #CCCCCC">
                <table>
                    <tr valign="top">
                        <td align="left" style="width: 220px;">
                            <asp:Label ID="lblSearchBy" runat="server" Font-Bold="True" Font-Names="arial,sans-serif"
                                Font-Size="12px">Search by: </asp:Label>
                                </br>                                
                                <asp:DropDownList ID="DropDownList1" runat="server"
                                    Font-Names="Arial" Font-Size="12px">
                                    <asp:ListItem>Select</asp:ListItem>
                                    <asp:ListItem>Hard Stops</asp:ListItem>
                                    <asp:ListItem>HOA</asp:ListItem>
                                    <asp:ListItem>Late Release</asp:ListItem>
                                    <asp:ListItem>Payment Denials</asp:ListItem>
                                    <asp:ListItem>Unworkable</asp:ListItem>
                                    <asp:ListItem>Work Status</asp:ListItem>
                                </asp:DropDownList>
                        </td>
                        <td align="left" style="width: 200px;">
                            <asp:Label ID="Label1" runat="server" Font-Names="arial,sans-serif" Font-Bold="True"
                                Font-Size="12px">Name: </asp:Label>
                                </br>
                                <asp:DropDownList ID="DropDownList2" runat="server"
                                    Font-Names="Arial" Font-Size="12px" Width="100px">
                                    <asp:ListItem>Select   </asp:ListItem>
                                </asp:DropDownList>
                        </td>
                        <td align="left" style="width: 70px;">
                            <asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Names="arial,sans-serif"
                                Font-Size="12px">From Date: </asp:Label>
                        </br>
                        <telerik:RadDatePicker ID="dateStart" runat="server" FocusedDate="" Skin="Web20"
                        Width="130px" TabIndex="2">
                        <Calendar ID="Calendar3" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
                            ViewSelectorText="x" Skin="Web20" ShowRowHeaders="false">
                        </Calendar>
                        <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                        <DateInput ID="DateInput3" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy">                       
                        </DateInput>
                    </telerik:RadDatePicker>                                                                       
                        </td>
                        <td align="left" style="width: 50px;">
                            <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Names="arial,sans-serif"
                                Font-Size="12px">To Date: </asp:Label>
                         </br>                            
                        <telerik:RadDatePicker ID="RadDatePicker2" runat="server" FocusedDate="" Skin="Web20"
                        Width="130px" TabIndex="2">
                        <Calendar ID="Calendar1" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
                            ViewSelectorText="x" Skin="Web20" ShowRowHeaders="false">
                        </Calendar>
                        <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                        <DateInput ID="DateInput1" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy">                       
                        </DateInput>
                    </telerik:RadDatePicker>                             
                        </td>
                        <td width="90px" valign="bottom">
                            <asp:Button ID="SearchButton" runat="server" Text="Search" SkinID="Web20"/>
                        </td>
                        <td valign="bottom">
                        <asp:Button ID="DefaultButton" runat="server" Text="Default View" SkinID="Web20"/>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="left: 5px; position: relative; left: 5px;">
                <br />
                <asp:Label ID="lblCurrentandPrior" runat="server" Font-Bold="True" Font-Size="Large"
                    Font-Names="Arial">Open Items Summary</asp:Label>
            </div>
            <div style="border: thin solid #5177B5; left: 5px; position: relative; left: 5px;
                width: 900px;">
                <table border="1" width="800px" style="border-collapse: collapse;">
                    <tr>
                        <td align="center" style="width: 145px; background-color: #7FA5D7;">
                            <asp:Label ID="hdrAssignee" runat="server" Text="Assignees" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 70px; background-color: #7FA5D7;">
                            <asp:Label ID="Label5" runat="server" Text="States" Font-Bold="True" Font-Names="arial,sans-serif"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 100px; background-color: #7FA5D7;">
                            <asp:Label ID="Label6" runat="server" Text="Jurisdictions" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 100px; background-color: #7FA5D7;">
                            <asp:Label ID="Label7" runat="server" Text="Total Items" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 110px; background-color: #7FA5D7;">
                            <asp:Label ID="Label8" runat="server" Text="Still Open" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 100px; background-color: #7FA5D7;">
                            <asp:Label ID="Label9" runat="server" Text="Unworkable" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 90px; background-color: #7FA5D7;">
                            <asp:Label ID="Label11" runat="server" Text="Workable" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                        <td align="center" style="width: 85px; background-color: #7FA5D7;">
                            <asp:Label ID="Label12" runat="server" Text="% Complete" Font-Bold="True" Font-Names="Arial"
                                Font-Size="12px" ForeColor="White"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 145px;">
                            <asp:Label ID="lblhdrAssignees" runat="server" Text=" " Font-Names="Arial" Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 70px;">
                            <asp:Label ID="lblhdrStates" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 100px;">
                            <asp:Label ID="lblhdrJurisdictions" runat="server" Font-Names="arial,sans-serif"
                                Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 100px;">
                            <asp:Label ID="lblhdrTotal" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 110px;">
                            <asp:Label ID="lblhdrStillOpen" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 100px;">
                            <asp:Label ID="lblhdrCannot" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 90px;">
                            <asp:Label ID="lblhdrWorkable" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
                        </td>
                        <td align="right" style="width: 85px;">
                            <asp:Label ID="lblComplete" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
                        </td>
                    </tr>
                </table>
            </div>
            <br />
            <div style="left: 5px; position: relative; left: 5px;">
                <asp:Label ID="Label10" runat="server" Font-Bold="True" Font-Size="Large" Font-Names="Arial">Open Items by Assignee</asp:Label>
                <telerik:RadGrid ID="grdOpenItemsByAssignee" AllowFilteringByColumn="True" Skin="Web20"
                    AllowSorting="True" AllowPaging="true" PageSize="100" runat="server" AutoGenerateColumns="False"
                    OnNeedDataSource="grdOpenItemsByAssignee_NeedDataSource" ShowStatusBar="true"
                    EnableLinqExpressions="false" Width="900px" Height="255px" OnExcelMLExportRowCreated="grdWorkItemsAssignee_ExcelMLExportRowCreated">
                    <ExportSettings FileName="OpenItemsAssignee" IgnorePaging="True" OpenInNewWindow="True"
                        ExportOnlyData="true" Excel-Format="ExcelML">
                    </ExportSettings>
                    <MasterTableView CommandItemDisplay="Bottom" AllowNaturalSort="false" UseAllDataFields="true"
                        AllowPaging="true">
                        <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
                            ShowRefreshButton="false" />
                        <Columns>
                            <telerik:GridBoundColumn DataField="AssigneeName" HeaderText="Assignee" UniqueName="AssigneeName"
                                >
                                <HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxTitle" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("AssigneeName").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="AssigneeIndexChanged" Width="145px"
                                        DataSource="<%# GenerateComboBoxAssigneesJuris() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
  
                                        <script type="text/javascript">
                                    function AssigneeIndexChanged(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("AssigneeName",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>           
                            <telerik:GridBoundColumn DataField="StateName" HeaderText="State" UniqueName="StateName"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="60px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxState" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("StateName").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="StateIndexChanged1" Width="50px"
                                        DataSource="<%# ComboBoxAssigneeState() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
  
                                        <script type="text/javascript">
                                    function StateIndexChanged1(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("StateName",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn DataField="JurisdictionCount" HeaderText="Jurisdictions"
                                UniqueName="JurisdictionCount" SortExpression="JurisdictionCount" AllowFiltering="false"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lbJurisdictionAssignee" runat="server" Text='<%# Eval("JurisdictionCount", "{0:N0}")%>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="TotalItems" HeaderText="Total Items" UniqueName="TotalItems"
                                SortExpression="TotalItems" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="75px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblTotalItemsAssignee" runat="server" Text='<%# Eval("TotalItems", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="OpenItemsCount" HeaderText="Still Open" UniqueName="OpenItemsCount"
                                SortExpression="OpenItemsCount" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="75px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lbStillOpenAssignee" runat="server" Text='<%# Eval("OpenItemsCount", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="UnworkableItemsCount" HeaderText="Unworkable"
                                UniqueName="UnworkableItemsCount" SortExpression="UnworkableItemsCount" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="105px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblUnworkableAssignee" runat="server" Text='<%# Eval("UnworkableItemsCount", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="WorkableItemsCount" HeaderText="Workable"
                                UniqueName="WorkableItemsCount" SortExpression="WorkableItemsCount" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="105px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblWorkableAssignee" runat="server" Text='<%# Eval("WorkableItemsCount", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="PercentComplete" HeaderText="% Complete" UniqueName="PercentComplete"
                                SortExpression="PercentComplete" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="80px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblPctCompleteAssignee" runat="server" Text='<%# Eval("PercentComplete", "{0:F2}%")%>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                    <HeaderStyle BorderStyle="Solid" />
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                </telerik:RadGrid>
            </div>
            <br />
            <div style="left: 5px; position: relative; left: 5px;">
                <asp:Label ID="Label13" runat="server" Font-Bold="True" Font-Size="Large" Font-Names="Arial">Open Items by Jurisdiction</asp:Label>
                <telerik:RadGrid ID="grdOpenItemsByJurisdiction" AllowFilteringByColumn="True" Skin="Web20"
                    AllowSorting="True" AllowPaging="true" PageSize="100" runat="server" AutoGenerateColumns="False"
                    OnNeedDataSource="grdOpenItemsByJurisdiction_NeedDataSource" ShowStatusBar="true" HeaderStyle-Width="900px"
                    EnableLinqExpressions="false" Width="900px" Height="255px" OnExcelMLExportRowCreated="grdWorkItemsJurisdiction_ExcelMLExportRowCreated">
                    <ExportSettings FileName="WorkItemsJurisdiction" IgnorePaging="True" OpenInNewWindow="True"
                        ExportOnlyData="true" Excel-Format="ExcelML">
                    </ExportSettings>
                    <MasterTableView CommandItemDisplay="Bottom" AllowNaturalSort="false" UseAllDataFields="true">
                        <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
                            ShowRefreshButton="false" />
                        <Columns>
                          <telerik:GridBoundColumn DataField="Assignee" HeaderText="Assignee" UniqueName="Assignee">
                                <HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxTitle" DataTextField="Value" DataValueField="Value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Assignee").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="TitleIndexChanged1" Width="145px"
                                        DataSource="<%# GenerateComboBoxAssigneesJuris() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
  
                                        <script type="text/javascript">
                                    function TitleIndexChanged1(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("Assignee",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="State" HeaderText="State" UniqueName="State"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="60px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxState" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("State").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="StateIndexChanged2" Width="50px"
                                        DataSource="<%# ComboBoxAssigneeState() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
  
                                        <script type="text/javascript">
                                    function StateIndexChanged2(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("State",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="WorkStatus" HeaderText="Work Status" UniqueName="WorkStatus"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboWorkStatus" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("WorkStatus").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="WorkIndexChanged" Width="150px"
                                        DataSource="<%# ComboBoxWorkStatus() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock4" runat="server">
  
                                        <script type="text/javascript">
                                    function WorkIndexChanged(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("WorkStatus",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <%-- <telerik:GridTemplateColumn DataField="State" HeaderText="State" UniqueName="State"
                                        SortExpression="State" AllowFiltering="false" Visible="true">
                                        <HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbState" runat="server" Text='<%# Eval("State") %>'></asp:Label>
                                        </ItemTemplate>
                                        <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                                    </telerik:GridTemplateColumn>--%>
                            <telerik:GridTemplateColumn DataField="JurisdictionELD" HeaderText="ELD" UniqueName="ELD"
                                SortExpression="JurisdictionELD" AllowFiltering="false" ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="60px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lbELD" runat="server" Text='<%# Eval("JurisdictionELD", "{0:M/yy}")%>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="Jurisdiction" HeaderText="Jurisdiction" UniqueName="Jurisdiction"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboJurisdiction" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" runat="server" OnClientSelectedIndexChanged="JurisIndexChanged"
                                        Width="150px" DataSource="<%# ComboBoxJurisdictions() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock5" runat="server">
  
                                        <script type="text/javascript">
                                    function JurisIndexChanged(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("Jurisdiction",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ProcurementMethod" HeaderText="Proc Meth" UniqueName="ProcurementMethod"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboProcMeth" DataTextField="Description" DataValueField="Description"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ProcurementMethod").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="ProcIndexChanged" Width="150px"
                                        DataSource="<%# GenerateProcMeth() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock6" runat="server">
  
                                        <script type="text/javascript">
                                    function ProcIndexChanged(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("ProcurementMethod",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn DataField="PercentComplete" HeaderText="% Complete" UniqueName="clmPctComplete"
                                SortExpression="PercentComplete" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="80px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblPctCompleteAssignee" runat="server" Text='<%# Eval("PercentComplete", "{0:F2}%")%>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="TotalItems" HeaderText="Total Items" UniqueName="TotalItems"
                                SortExpression="TotalItems" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblTotalItemsAssignee" runat="server" Text='<%# Eval("TotalItems", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="StillOpenCount" HeaderText="Still Open" UniqueName="StillOpen"
                                SortExpression="StillOpenCount" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lbStillOpenAssignee" runat="server" Text='<%# Eval("StillOpenCount", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="UnworkableItemsCount" HeaderText="Unworkable"
                                UniqueName="Unworkable" SortExpression="UnworkableItemsCount" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="105px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblUnworkableAssignee" runat="server" Text='<%# Eval("UnworkableItemsCount", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="WorkableItemsCount" HeaderText="Workable"
                                UniqueName="WorkableItemsCount" SortExpression="WorkableItemsCount" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="105px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblWorkableAssignee" runat="server" Text='<%# Eval("WorkableItemsCount", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="IsLR" HeaderText="LR" UniqueName="IsLR" 
                                ItemStyle-HorizontalAlign="Center" SortExpression="IsLR">
                                <HeaderStyle Font-Bold="True" Width="60px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxLR" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("IsLR").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="LRIndexChanged" Width="50px" DataSource="<%# ComboYesNo() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock7" runat="server">
  
                                        <script type="text/javascript">
                                    function LRIndexChanged(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("IsLR",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="IsHOA" HeaderText="HOA" UniqueName="IsHOA"
                                ItemStyle-HorizontalAlign="Center" SortExpression="isHOA">
                                <HeaderStyle Font-Bold="True" Width="60px" HorizontalAlign="Center" Font-Names="Arial" />
                                <FilterTemplate>
                                    <telerik:RadComboBox ID="RadComboBoxHOA" DataTextField="value" DataValueField="value"
                                        AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("IsHOA").CurrentFilterValue %>'
                                        runat="server" OnClientSelectedIndexChanged="HOAIndexChanged" Width="50px" DataSource="<%# ComboYesNo() %>">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="All" />
                                        </Items>
                                    </telerik:RadComboBox>
                                    <telerik:RadScriptBlock ID="RadScriptBlock8" runat="server">
  
                                        <script type="text/javascript">
                                    function HOAIndexChanged(sender,args) {
                                        var tableView=$find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("IsHOA",args.get_item().get_value(),"EqualTo");
                                          
                                    }
                                        </script>
  
                                    </telerik:RadScriptBlock>
                                </FilterTemplate>
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn DataField="TSPayeeCode" HeaderText="TS Payee" UniqueName="TSPayee"
                                SortExpression="TSPayeeCode" AllowFiltering="false">
                                <HeaderStyle Font-Bold="True" Width="105px" HorizontalAlign="Center" Font-Names="Arial" />
                                <ItemTemplate>
                                    <asp:Label ID="lblTSPayee" runat="server" Text='<%# Eval("TSPayeeCode", "{0:N0}") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Right" ForeColor="Black" />
                                <FooterStyle HorizontalAlign="Right" Font-Bold="true" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="AssigneeEmployeeKey" ReadOnly="True" UniqueName="AssigneeEmployeeKey"
                                Visible="False">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <HeaderStyle BorderStyle="Solid" />
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                </telerik:RadGrid>
            </div>
        </asp:Panel>
    </asp:Panel>
    </form>
</body>
</html>
Any help would be appreciated.
Iana Tsolova
Telerik team
 answered on 23 Aug 2011
3 answers
212 views
My site has a lot of grids for which we do specialized formatting, especially for date/time and currency data. Although it works to use GridTemplateColumns and use Eval statements to do the special formatting, it's becoming increasingly unwieldy to write all those template columns. Therefore, we have created a column class inherited from GridBoundColumn. The primary purpose of this column is to override FormatDataValue with our custom formatting:

protected override string FormatDataValue(object dataValue, GridItem item)
{
    return FormatString(dataValue, DataBinder.GetDataItem(item));
}
 
protected virtual string FormatString(object dataValue, object DataItem)
{
    if (dataValue != null)
    {
        String lc = LanguageCodeField.HasValue()
                            ? DataBinder.Eval(DataItem, LanguageCodeField).ToString()
                            : String.Empty;
        CultureInfo ci = lc.HasValue()
                                 ? new CultureInfo(lc)
                                 : CultureInfo.CurrentCulture;
 
        if(DataFormatString.HasValue())
        {
            return String.Format(ci, DataFormatString, dataValue);
        }
        if (dataValue is DateTime)
        {
            return Dates.GetShortDateTimeString(dataValue as DateTime?);
        }
        if(IsCurrency)
        {
            double dv = Convert.ToDouble(dataValue);
 
            return Cultures.FormatCurrencyValue(lc, dv);
        }
 
        return String.Format(ci, "{0}", dataValue);
       
    }
    return String.Empty;
}
Note: HasValue = !String.IsNullOrEmpty; and Dates.GetShortDateTimeString and Cultures.FormatCurrencyValue are our standard formatting functions for dates and currencies, respectively. LanguageCodeField is a property that we added to our column in order to allow our DataTable to specify different currencies/date formats on a row-by-row basis, and we assume that it will eval to culture strings like "en-US".

Our big problem now is that the Grid Footers aren't applying our formatting. They apparently don't run through FormatDataValue. Here's the code for our column and the GridBoundColumn and I've attached a screen shot that shows the difference when LangaugeCodeField evaluates to "en-GB" even though my computer's culture is the US. (Note: We only enable the footer when LanguageCodeField is the same for all rows -- that's not an issue. If we need to aggregate it, too, we can use "first" with no problem.)
<cc2:MyBoundColumn HeaderText="[Total New]" UniqueName="TOTALEXPENSECALC2" DataField="TOTALEXPENSE" Resizable="false" Reorderable="false"
     LanguageCodeField="LANGUAGECODE" Aggregate="Sum" FooterStyle-CssClass="textbold" FooterText="Page Total " />
<telerik:GridBoundColumn HeaderText="[Total Standard]" UniqueName="TOTALEXPENSECALC3" DataField="TOTALEXPENSE" Resizable="false" Reorderable="false"
      Aggregate="Sum" FooterStyle-CssClass="textbold" FooterText="Page Total " DataFormatString="{0:C}"  />

As you can see in the screen shot, the "Footer Text" property and CssClass are applying properly (Yay!), but we need the Total itself to be formatted in the correct currency. Please help us figure out what to override or what event we have to tie into in order to make custom formatting work for the footer of our inherited column.

--Christina
Radoslav
Telerik team
 answered on 23 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?