Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
156 views
Hi All

I'm having some trouble with the DateTimePicker;
<telerik:RadDateTimePicker ID="dtpWhen" Width="200px" runat="server" AutoPostBackControl="Calendar">
    <TimeView ID="TimeView3" Interval="0:30" Columns="4" RenderDirection="Vertical" runat="server" />
    <Calendar>
        <SpecialDays>
            <telerik:RadCalendarDay Repeatable="Today" ItemStyle-BackColor="Pink" />
        </SpecialDays>
    </Calendar>
</telerik:RadDateTimePicker>

When I call dtpWhen.DbSelectedDate = i("uatWhen"), the date is set correctly per the database, but the time is always set to 12:00.

Debug.WriteLine(i("uatWhen")) gives 7/05/2012 10:48:59 AM as expected.

I've also tried setting the value using just .SelectedDate with no luck.

Does anyone see something I'm doing wrong?
Eyup
Telerik team
 answered on 15 May 2012
3 answers
171 views
I have two combo boxes, where second are loading/reloading by selected item from first.
I am using OnClientSelectedIndexChangingand  and OnClientItemsRequested to make dependency this two combos.
After selecting item from first combo, second combo doesn't expand when I click on him.
But if I click anywhere else and then on second combo it expand.
This was working till last update of telerik.

Any idea to solv this?
Thank you
Princy
Top achievements
Rank 2
 answered on 15 May 2012
3 answers
184 views
Hi,

I am new to Entity framework 4.0 combine with telerik and I want your help please. I have a grid which is bind to Users entity. All users are assigned to a role (administrator,manager....e.t.c). The relation is many to one. On the grid I manage to displayed the users with all the necessary information including the roles. The user role is displayed inside the grid having a radcombobox and using a separate entitydatasource to fetch all the availble roles exists in database.
- My first problem is that the "role" comboBox doesn't select the correct value each user has during grid load(the first item is always selected).
- Second main problem is that if I want to update a record no changes are applied to the selected record(nothing happens).

Sample code below:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
        AllowPaging="True" AllowSorting="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
            AllowAutomaticDeletes="True" AutoGenerateDeleteColumn="True"
        AutoGenerateEditColumn="True" DataSourceID="EntityDataSource1">
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID"
                DataSourceID="EntityDataSource1" CommandItemDisplay="Top">
    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
    <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>
    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
    <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="NAME"
                FilterControlAltText="Filter NAME column" HeaderText="NAME"
                SortExpression="NAME" UniqueName="NAME">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SURNAME"
                FilterControlAltText="Filter SURNAME column" HeaderText="SURNAME"
                SortExpression="SURNAME" UniqueName="SURNAME">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn DataField="ROLE_ID" DataType="System.Int32"
                FilterControlAltText="Filter ROLE_ID column" HeaderText="ROLE_ID"
                SortExpression="ROLE_ID" UniqueName="ROLE_ID">
                <EditItemTemplate>
                    <asp:EntityDataSource ID="roleDS" runat="server"
                        ConnectionString="name=TestDbEntities" DefaultContainerName="TESTDbEntities"
                        EnableFlattening="False" EntitySetName="ROLE" Select="it.[ID], it.[NAME]">
                    </asp:EntityDataSource>
                    <telerik:RadComboBox ID="ROLE_IDComboBox"   runat="server" DataSourceID="RoleDS" DataTextField="NAME" DataValueField="ID">
                    </telerik:RadComboBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="ROLE_IDLabel" runat="server" Text='<%# Eval("ROLE_ID") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    <EditFormSettings>
    <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
    </EditFormSettings>
    </MasterTableView>
    <FilterMenu EnableImageSprites="False"></FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>
     
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=TestDbEntities" DefaultContainerName="TESTDbEntities"
EnableDelete="True" EnableFlattening="False" EnableInsert="True"
EnableUpdate="True" EntitySetName="USER">
</asp:EntityDataSource>


Can you provide me an example using entity framework with grid having many to one relation records. I can't find any examples.

Thanks in advance
Daniel
Telerik team
 answered on 15 May 2012
3 answers
124 views
Hello,
I noticed this change here: http://www.telerik.com/products/aspnet-ajax/whats-new/release-history/q2-2011-version-2011-2-712.aspx

We were previously using this property so that our insert item would show at all times.  In this case, our RadListView should have the InsertItemTemplate exposed at all times but after upgrading from the Q1 to Q2 release, the fix which disables this behavior in Q2 changes the way the ListView control performs.  What is the recommended way to always show the InsertItemTemplate?  We have several pages which are using several instances of the RadListView control, all of which we want the InsertItem available at all times.

Thanks,
Ben
Peter
Top achievements
Rank 1
 answered on 15 May 2012
2 answers
116 views

I have used a RadTreeView control in an aspx page, where the Root element has been associated an "Add " context menu.

While the ContextMenuItemClick event is fired on the server side when viewed from Opera 11, Firefox 11, Chrome 17, Internet Explorer 8, it does not fire when viewed from Internet Explorer 9 - it only adds a # tag at the end of the URL and no PostBack is executed.

I have tried to set the PostBack property of the Context menu item to true, to false - to no avail.

Please let me know if there is something that I am missing.

Thank you.
Zoltan

PS. Below is the mark-up used in my page:

<telerik:RadTreeView ID="CollectiveNameTree" runat="server"
    EnableDragAndDrop="true"
    EnableDragAndDropBetweenNodes="true"
    MultipleSelect="false"
    EnableViewState="true"
    OnNodeEdit="CollectiveNameTree_NodeEdit"
    OnClientNodeEditing="onClientNodeEditing"
    OnNodeDrop="CollectiveNameTree_HandleDrop"
    OnClientContextMenuItemClicking="onClientContextMenuItemClicking"
    OnClientContextMenuShowing="onClientContextMenuShowing"
    OnClientDoubleClick="onClientNodeDoubleClicking"
    OnClientNodeDragStart="onClientNodeDragStart"
    OnClientNodeDropping="onClientNodeDropping"
    OnClientNodeDragging="onClientNodeDragging"
    >
    <WebServiceSettings Path="~/WebServices/Substances.asmx" Method="GetTreeViewCategories" />
    <Nodes>
        <telerik:RadTreeNode Text="<%$ Resources:Buttons,ClassificationsRootNodeTitle %>" PostBack="true"
            Expanded="false" ExpandMode="WebService" Value="1" ContextMenuID="RootContextMenu" />
    </Nodes>
    <ContextMenus>
        <telerik:RadTreeViewContextMenu ID="RootContextMenu" runat="server">
            <Items>
                <telerik:RadMenuItem Value="AddClassification"
                    Text="<%$ Resources:Buttons,AddClassification %>" />
            </Items>
        </telerik:RadTreeViewContextMenu>
    </ContextMenus>
</telerik:RadTreeView>

 

Zoltan
Top achievements
Rank 1
 answered on 15 May 2012
10 answers
377 views
I am trying to dynamically resize the grid to fill an area on the screen when the user resizes the browser.
In order to determine the 'GridData' area, I need to know the height of the static header row ('GridHeader').
When I create the control, the height is always 20.
Once I resize the browser, the header height is 33. 
Why the difference and how can I get the 33 when the control is created?

Thanks,
Eric
wnl
Top achievements
Rank 1
 answered on 15 May 2012
3 answers
62 views
After upgrading to the recent build we have noticed a problem with spaces being stripped on paste (somewhat randomly)

We are able to duplicate the problem in our system AND on your demo.

Browser: Chrome 18.0.1025.168 m
Build: Telerik.Web.UI_2012_1_411_Dev_hotfix

If you paste the following content directly from a word doc (or Outlook email)

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec elementum vehicula condimentum. Vivamus sed neque arcu. Proin mattis tristique ante, ac tincidunt sem vulputate sed. Vestibulum et elit ac lorem sagittis blandit a vitae dui. Sed aliquet fermentum pulvinar. Nunc erat ante, euismod sit amet blandit pulvinar, semper sed orci. Pellentesque egestas tempus magna, vitae interdum dui feugiat a. Duis a vestibulum arcu. Nam arcu turpis, fringilla in consectetur pulvinar, hendrerit sed sem. Phasellus id sem odio. Nam quis ante lectus. In non sapien vitae turpis pulvinar congue. Ut porta auctor nisl non hendrerit. Proin eget odio at nibh faucibus laoreet.


Some words lose the spaces between them.  For example "Donec elementum vehicula" goes to "Donec elementumvehicula"

Pasting into THIS editor (the forum) works fine.  Pasting into the demo (http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx) the problem exists.

The editor on the demo alerts me if I'd like to strip formatting. If I say yes, the problem exists.  If I say cancel, it pastes ok.

Reverting to the previous build in our app resolved the problem.  I notice it doesn't always occur depending on where I paste from.  But it can be duplicated every time by pasting from word. Its just pasting directly from Word into the demo editor.

Thanks for any input you can provide.
Rumen
Telerik team
 answered on 15 May 2012
1 answer
219 views
Hi , I'm trying to use RadScriptManager
on my project
I know that I'm using the framework 4.5 but I would like to know if this is an error of my installation or 
is something will be fix in the future

When I use the radScriptmanager set as below 
I get error 404 on fiddler 
for these two files

http://ajax.aspnetcdn.com/ajax/4.5/3/MicrosoftAjax.debug.it.js

http://ajax.aspnetcdn.com/ajax/4.5/3/MicrosoftAjaxWebForms.debug.it.js 

---
Thanks
Giovanni

 <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableCdn="true">
         <Groups>
        <telerik:ScriptReferenceGroup>
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"   />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" />
            </Scripts>
        </telerik:ScriptReferenceGroup>
    </Groups>
    </telerik:RadScriptManager>



Genady Sergeev
Telerik team
 answered on 15 May 2012
2 answers
108 views
Hi

I use detailedtable in radgrid. Everything goes well as screenshot shows. However, when I try to set dataformat of column in Grid, the detailedtable does not show anymore. It seems expand icon does trigger event DetailTableDataBind and detailedtable.datasource does has data. It confuses me that why the detailedtable disappears.

Can anyone help me? Thank you in advance.

here is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Control.UserRequest;
using Control.Global;
using Control.Position_C;
using Control.Salesman_C;
using Control.Depart_C;
using Model;
using Telerik.Web.UI;
using Control.Bill_C;
 
namespace ERP.SalesAnalysis
{
    public partial class BillByCustMonth : Is_Login
    {
        private UserRequestController urc = null;
        IList<Cust> custList = null;
        IList<Dept> departList = null;
        IList<Salesman> salesList = null;
        static string digit = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                urc = GlobalUserController.get_login_user_request_controller(Session["userID"].ToString());
                string permitString = urc.getBillByCustMonthPermit();
 
                LoadPosition();
                LoadCustomerComboBox(urc);
                LoadDepartment();
                LoadSalesman();
                setPermit(permitString, urc);
                YearComboBox.SelectedValue = DateTime.Now.Year.ToString();
                decimal p = SystemParamController.param.amt_point;
                //decimal p = 2; for test
                digit = "";
                for (decimal i = 0; i < p; i++)
                {
                    digit += "0";
                }
                if (digit != "")
                {
                    digit = "{0:#,#." + digit + "}";
                }
                else
                {
                    digit = "{0:#,#}";
                }
            }
        }
 
        
 
        private void LoadSalesman()
        {
 
            salesList = SalesmanController.getAllSalesmanList();
            if (salesList.Count != 0)
                for (int i = 0; i < salesList.Count; i++)
                {
                    SalesmanComboBox1.Items.Add(new RadComboBoxItem(salesList[i].salesmanId.deptcode + "\t" + salesList[i].salesmanId.name, salesList[i].salesmanId.name));
                    SalesmanComboBox2.Items.Add(new RadComboBoxItem(salesList[i].salesmanId.deptcode + "\t" + salesList[i].salesmanId.name, salesList[i].salesmanId.name));
                }
 
            SalesmanComboBox1.ClearSelection();
            SalesmanComboBox2.ClearSelection();
              
        }
 
        private void LoadDepartment()
        {
            departList = DepartController.getDepartList();
            DepartComboBox1.DataSource = departList;
            DepartComboBox1.DataTextField = "deptcode";
            DepartComboBox1.DataValueField = "deptcode";
            DepartComboBox1.DataBind();
 
            DepartComboBox2.DataSource = departList;
            DepartComboBox2.DataTextField = "deptcode";
            DepartComboBox2.DataValueField = "deptcode";
            DepartComboBox2.DataBind();
 
        }
 
        private void setPermit(string permitString, UserRequestController urc)
        {
             
        }
 
        protected void LoadPosition()
        {
            PositionComboBox.DataSource = PositionController.getPositionList();
            PositionComboBox.DataTextField = "p_code";
            PositionComboBox.DataValueField = "p_code";
            PositionComboBox.DataBind();
 
        }
 
        protected void LoadCustomerComboBox(UserRequestController urc)
        {
 
            custList = urc.getCustomerListByUser();
            CustomerComboBox1.HighlightTemplatedItems = true;
            CustomerComboBox1.DataSource = custList;
            CustomerComboBox1.DataTextField = "c_code";
            CustomerComboBox1.DataValueField = "c_code";
            CustomerComboBox1.DataBind();
 
            CustomerComboBox2.HighlightTemplatedItems = true;
            CustomerComboBox2.DataSource = custList;
            CustomerComboBox2.DataTextField = "c_code";
            CustomerComboBox2.DataValueField = "c_code";
            CustomerComboBox2.DataBind();
 
        }
        protected void BillGrid_PreRender(object sender, System.EventArgs e)
        {
            setFormat();
        }
 
        protected void setFormat()
        {
            string format = digit;
            if (!StandardCurrency.Checked)
            {
                format = "{0:#,#.00}";
            }
            foreach (GridColumn column in BillGrid.Columns)
            {
                if (column.UniqueName == "Sales1" || column.UniqueName == "Sales2" || column.UniqueName == "Sales3" ||
                    column.UniqueName == "Sales4" || column.UniqueName == "Sales5" || column.UniqueName == "Sales6" ||
                    column.UniqueName == "Sales7" || column.UniqueName == "Sales8" || column.UniqueName == "Sales9" ||
                    column.UniqueName == "Sales10" || column.UniqueName == "Sales11" || column.UniqueName == "Sales12")
                {
 
                    (column as GridBoundColumn).DataFormatString = format;
                }
                else if (column.UniqueName == "Sum" || column.UniqueName == "Avg")
                {
 
                    (column as GridCalculatedColumn).DataFormatString = format;
                }
            }
            BillGrid.Rebind(); 
        }
        protected void BillGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                string year = YearComboBox.SelectedValue;
                string position = PositionComboBox.SelectedValue;
                string startDept = DepartComboBox1.SelectedValue;
                string endDept = DepartComboBox2.SelectedValue;
                string startSales = SalesmanComboBox1.SelectedValue;
                string endSales = SalesmanComboBox2.SelectedValue;
                string startCust = CustomerComboBox1.SelectedValue;
                string endCust = CustomerComboBox2.SelectedValue;
                bool standard = true;
                if (!StandardCurrency.Checked)
                {
                    standard = false;
                }
                BillGrid.DataSource = BillController.getBill(year, position, startDept, endDept, startSales, endSales, startCust, endCust, standard);
                 
            }
        }
 
        protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            switch (e.DetailTableView.Name)
            {
                case "BillDetails":
                    {
                        string year = YearComboBox.SelectedValue;
                        string position = PositionComboBox.SelectedValue;
                        string startCust = CustomerComboBox1.SelectedValue;
                        string endCust = CustomerComboBox2.SelectedValue;
                        bool standard = true;
                        if (!StandardCurrency.Checked)
                        {
                            standard = false;
                        }
                        string salesman = dataItem.GetDataKeyValue("Salesman").ToString();
                         
                        e.DetailTableView.DataSource = BillController.getBillBySaleman(year, position, salesman, startCust, endCust,standard);
                        //e.DetailTableView.Rebind();
 
                        break;
                    }
 
            }
        }
 
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            string year = YearComboBox.SelectedValue;
            string position = PositionComboBox.SelectedValue;
            string startDept = DepartComboBox1.SelectedValue;
            string endDept = DepartComboBox2.SelectedValue;
            string startSales = SalesmanComboBox1.SelectedValue;
            string endSales = SalesmanComboBox2.SelectedValue;
            string startCust = CustomerComboBox1.SelectedValue;
            string endCust = CustomerComboBox2.SelectedValue;
            bool standard = true;
            if (!StandardCurrency.Checked) {
                standard = false;
            }
 
            BillGrid.DataSource = BillController.getBill(year, position, startDept, endDept, startSales, endSales, startCust, endCust, standard);
            BillGrid.Rebind();
            setFormat();
        }
 
    }
}


<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="BillByCustMonth.aspx.cs" Inherits="ERP.SalesAnalysis.BillByCustMonth" %>
 
<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.0.12.302, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
    Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="SearchButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="BillGrid"  />
                    </UpdatedControls>
                </telerik:AjaxSetting>
     </AjaxSettings>
</telerik:RadAjaxManager>
<table width="100%">
<tr>
<td><asp:label id="PositionLabel" runat="server" Text="<%$ Resources:language,position%>"></asp:label></td>
<td>
 <telerik:RadComboBox ID="PositionComboBox" Runat="server"
        Width="150px" Height="150px">
        <headertemplate>
       <table style="width:100px;">
           <tr>
               <td style="width:40px;">编码</td>
               <td style="width:60px;">名称</td>
           </tr>
       </table>                               
    </headertemplate>
     <itemtemplate>
       <table style="width:100px;">
           <tr>
               <td style="width:40px;"><%# DataBinder.Eval(Container.DataItem, "p_code") %></td>
               <td style="width:60px;"><%# DataBinder.Eval(Container.DataItem, "p_name") %></td>
           </tr>
       </table>
    </itemtemplate>
    </telerik:RadComboBox>
</td>
<td><asp:label id="Label1" runat="server" Text="<%$ Resources:language,department%>"></asp:label></td>
<td><telerik:RadComboBox ID="DepartComboBox1" Runat="server" Width="150px" AllowCustomText="True"
        Height="150px"
       >
        <headertemplate>
       <table style="width:100px;">
           <tr>
               <td style="width:40px;">编码</td>
               <td style="width:60px;">名称</td>
           </tr>
       </table>                               
    </headertemplate>
     <itemtemplate>
       <table style="width:100px;">
           <tr>
               <td style="width:40px;"><%# DataBinder.Eval(Container.DataItem, "deptcode")%></td>
               <td style="width:60px;"><%# DataBinder.Eval(Container.DataItem, "deptname")%></td>
           </tr>
       </table>
    </itemtemplate>
    </telerik:RadComboBox>
</td>
<td><telerik:RadComboBox ID="DepartComboBox2" Runat="server" Width="150px" AllowCustomText="True"  Height="150px">
        <headertemplate>
       <table style="width:100px;">
           <tr>
               <td style="width:40px;">编码</td>
               <td style="width:60px;">名称</td>
           </tr>
       </table>                               
    </headertemplate>
     <itemtemplate>
       <table style="width:100px;">
           <tr>
               <td style="width:40px;"><%# DataBinder.Eval(Container.DataItem, "deptcode")%></td>
               <td style="width:60px;"><%# DataBinder.Eval(Container.DataItem, "deptname")%></td>
           </tr>
       </table>
    </itemtemplate>
    </telerik:RadComboBox>
</td>
<td><asp:label id="Label2" runat="server" Text="<%$ Resources:language,salesman%>"></asp:label></td>
<td><telerik:RadComboBox ID="SalesmanComboBox1" Runat="server" Height="150px" Width="100px" AllowCustomText="True" >
    </telerik:RadComboBox>
</td>
<td><telerik:RadComboBox ID="SalesmanComboBox2" Runat="server" Height="150px" Width="100px" AllowCustomText="True" >
    </telerik:RadComboBox>
</td>
</tr>
<tr>
<td><asp:label id="Label3" runat="server" Text="<%$ Resources:language,year%>"></asp:label></td>
<td>
<telerik:RadComboBox ID="YearComboBox" Runat="server"  Filter="StartsWith"
 Width="100px"  Height="150px"   DataTextField="Text" DataValueField="Value"
        DataSourceID="XmlDataSource1" >
</telerik:RadComboBox>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server"
        DataFile="~/Common/year.xml"></asp:XmlDataSource>
</td>
<td><asp:label id="Label4" runat="server" Text="<%$ Resources:language,customerID%>"></asp:label></td>
<td><telerik:RadComboBox ID="CustomerComboBox1" Runat="server" AllowCustomText="True"
        Height="250px" >
     <headertemplate>
       <table style="width:160px">
           <tr>
               <td style="width:60px;">编码</td>
               <td style="width:100px;">名称</td>
           </tr>
       </table>                               
    </headertemplate>
     <itemtemplate>
       <table style="width:160px">
           <tr>
               <td style="width:60px;"><%# DataBinder.Eval(Container.DataItem, "c_code") %></td>
               <td style="width:100px;"><%# DataBinder.Eval(Container.DataItem, "c_abrname") %></td>
           </tr>
       </table>
    </itemtemplate>
    </telerik:RadComboBox></td>
    <td><telerik:RadComboBox ID="CustomerComboBox2" Runat="server"
        Height="250px"  AllowCustomText="True" >
     <headertemplate>
       <table style="width:160px">
           <tr>
               <td style="width:60px;">编码</td>
               <td style="width:100px;">名称</td>
           </tr>
       </table>                               
    </headertemplate>
     <itemtemplate>
       <table style="width:160px">
           <tr>
               <td style="width:60px;"><%# DataBinder.Eval(Container.DataItem, "c_code") %></td>
               <td style="width:100px;"><%# DataBinder.Eval(Container.DataItem, "c_abrname")%></td>
           </tr>
       </table>
    </itemtemplate>
    </telerik:RadComboBox></td>
<td><asp:label id="Label5" runat="server" Text="<%$ Resources:language,currency%>"></asp:label></td>
<td>
<asp:RadioButton ID="StandardCurrency" runat="server" Text="<%$ Resources:language,standardCurrency%>" Checked="true" GroupName="currency"></asp:RadioButton>
<asp:RadioButton ID="ForeCurrency" runat="server" Text="<%$ Resources:language,foreCurrency%>" GroupName="currency"></asp:RadioButton>
</td>
</tr>
<tr>
<td colspan="8" align="right">
<telerik:RadButton runat="server"  ID="SearchButton" Text="<%$ Resources:language,search%>"
        onclick="SearchButton_Click"></telerik:RadButton>
</td>
</tr>
</table>
  <telerik:RadGrid ID="BillGrid" Width="100%" runat="server" Height="375px" 
        AllowPaging="true" AutoGenerateColumns="False" PageSize="10" AllowSorting="True"
        OnNeedDataSource="BillGrid_NeedDataSource" OnPreRender="BillGrid_PreRender"
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
        Skin="Office2010Blue"  >
    <MasterTableView Width="100%" AllowMultiColumnSorting="false" GroupLoadMode="Server" DataKeyNames="Salesman"  ShowFooter="true"  CssClass="number">
    <DetailTables>
        <telerik:GridTableView DataKeyNames="Salesman" Name="BillDetails" Width="100%" ShowFooter="false" ShowHeader="false" CssClass="number" >
            <Columns>
                <telerik:GridBoundColumn HeaderStyle-Width="80px" DataField="Blanck"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn HeaderStyle-Width="80px" DataField="Blanck"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn HeaderStyle-Width="90px" DataField="Custcode"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn HeaderStyle-Width="90px" DataField="Custname"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales21" HeaderStyle-Width="80px" DataField="Sales1" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales22" HeaderStyle-Width="80px" DataField="Sales2" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales23" HeaderStyle-Width="80px" DataField="Sales3" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales24" HeaderStyle-Width="80px" DataField="Sales4" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales25" HeaderStyle-Width="80px" DataField="Sales5" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales26" HeaderStyle-Width="80px" DataField="Sales6" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales27" HeaderStyle-Width="80px" DataField="Sales7" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales28" HeaderStyle-Width="80px" DataField="Sales8" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales29" HeaderStyle-Width="80px" DataField="Sales9" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales210" HeaderStyle-Width="80px" DataField="Sales10" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn   UniqueName="Sales211" HeaderStyle-Width="80px" DataField="Sales11" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn  UniqueName="Sales212" HeaderStyle-Width="80px" DataField="Sales12" DataFormatString="{0:###,###.##}"></telerik:GridBoundColumn>
                <telerik:GridCalculatedColumn  UniqueName="Sum2" HeaderStyle-Width="80px" DataFields="Sales1,Sales2,Sales3,Sales4,Sales5,Sales6,Sales7,Sales8,Sales9,Sales10,Sales11,Sales12" Expression="{0}+{1}+{2}+{3}+{4}+{5}+{6}+{7}+{8}+{9}+{10}+{11}" DataFormatString="{0:###,###.##}"></telerik:GridCalculatedColumn>
                <telerik:GridCalculatedColumn   UniqueName="Avg2" HeaderStyle-Width="80px" DataFields="Sales1,Sales2,Sales3,Sales4,Sales5,Sales6,Sales7,Sales8,Sales9,Sales10,Sales11,Sales12" Expression="({0}+{1}+{2}+{3}+{4}+{5}+{6}+{7}+{8}+{9}+{10}+{11})/12" DataFormatString="{0:###,###.##}"></telerik:GridCalculatedColumn>
            </Columns>
        </telerik:GridTableView>
      </DetailTables>
 
        <Columns>
        <telerik:GridBoundColumn HeaderText="<%$ Resources:language,department%>" HeaderStyle-Width="80px" DataField="Depart"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn HeaderText="<%$ Resources:language,salesman%>" HeaderStyle-Width="80px"  DataField="Salesman"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn HeaderText="<%$ Resources:language,customerId%>" HeaderStyle-Width="90px"  DataField="Custcode"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn HeaderText="<%$ Resources:language,customerName%>" HeaderStyle-Width="90px"  DataField="Custname"></telerik:GridBoundColumn>
        <telerik:GridNumericColumn HeaderText="1月份" UniqueName="Sales1" HeaderStyle-Width="80px" DataField="Sales1" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="2月份" UniqueName="Sales2" HeaderStyle-Width="80px" DataField="Sales2" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="3月份" UniqueName="Sales3" HeaderStyle-Width="80px" DataField="Sales3" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="4月份" UniqueName="Sales4" HeaderStyle-Width="80px" DataField="Sales4" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="5月份" UniqueName="Sales5" HeaderStyle-Width="80px" DataField="Sales5" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="6月份" UniqueName="Sales6" HeaderStyle-Width="80px" DataField="Sales6" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="7月份" UniqueName="Sales7" HeaderStyle-Width="80px" DataField="Sales7" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="8月份" UniqueName="Sales8" HeaderStyle-Width="80px" DataField="Sales8" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="9月份" UniqueName="Sales9" HeaderStyle-Width="80px" DataField="Sales9"  Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="10月份" UniqueName="Sales10" HeaderStyle-Width="80px" DataField="Sales10" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="11月份" UniqueName="Sales11" HeaderStyle-Width="80px" DataField="Sales11" Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridNumericColumn HeaderText="12月份" UniqueName="Sales12" HeaderStyle-Width="80px" DataField="Sales12"  Aggregate="Sum"></telerik:GridNumericColumn>
        <telerik:GridCalculatedColumn HeaderText="总计" UniqueName="Sum" HeaderStyle-Width="80px"  DataFields="Sales1,Sales2,Sales3,Sales4,Sales5,Sales6,Sales7,Sales8,Sales9,Sales10,Sales11,Sales12" Expression="{0}+{1}+{2}+{3}+{4}+{5}+{6}+{7}+{8}+{9}+{10}+{11}" ></telerik:GridCalculatedColumn>
        <telerik:GridCalculatedColumn HeaderText="月平均" UniqueName="Avg" HeaderStyle-Width="80px"  DataFields="Sales1,Sales2,Sales3,Sales4,Sales5,Sales6,Sales7,Sales8,Sales9,Sales10,Sales11,Sales12" Expression="({0}+{1}+{2}+{3}+{4}+{5}+{6}+{7}+{8}+{9}+{10}+{11})/12"></telerik:GridCalculatedColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings>
           <Selecting AllowRowSelect="True"></Selecting>
           <Resizing AllowColumnResize="true" EnableRealTimeResize="True"/>
           <Scrolling UseStaticHeaders="true" AllowScroll="true" />
     </ClientSettings>
  </telerik:RadGrid>
</asp:Content>

Wenting
Top achievements
Rank 1
 answered on 15 May 2012
1 answer
384 views
            I need to hide the filter icon, enable the AutoPostBackOnFilter and set the default filter function value.
The default filter function may be different for each column depending on what the client wants.

I have a problem. 
When the application loads, the filters are exactly what I specified in the CurrentFilterFunction property.
When I filter the first column, the filters reset to something else.

<telerik:RadGrid AutoGenerateColumns="false" ID="RadGrid1" DataSourceID="SqlDataSource1" AllowFilteringByColumn="True" PageSize="15" AllowPaging="True" runat="server" >           
    <MasterTableView >
       
<Columns>
           
<telerik:GridNumericColumn DataField="OrderID" HeaderText="OrderID" AutoPostBackOnFilter="true" CurrentFilterFunction="LessThanOrEqualTo" />
            <telerik:GridBoundColumn  DataField="ShipName" HeaderText="ShipName" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" />
            <telerik:GridDateTimeColumn  DataField="OrderDate" HeaderText="OrderDate" AutoPostBackOnFilter="true" CurrentFilterFunction="LessThanOrEqualTo" />                   
        </Columns>                                             
   
</MasterTableView>           
</telerik:RadGrid>


<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Orders" runat="server">
</asp:SqlDataSource>


In this example, when I filter the shipName with the letter 'a', it is filtered correctly with the "Contains" filter expression.
Then I filter the OrderId with the value 10300. 
I expect the filter function to be "LessThanOrEqualTo" as I specified, but instead, it is set to "EqualTo". 
Is it a bug ?
Is there a workaround ?
Shinu
Top achievements
Rank 2
 answered on 15 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?