Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
533 views
I have a problem with the OnTextChanged event of the RadComboBox. The combobox looks like this:

<telerik:RadComboBox ID="RadCB"  runat="server" Width="130px" AutoPostBack="true" OnTextChanged="RadCB_TextChanged" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Localization-CheckAllString="(All)" EmptyMessage="Select" CheckedItemsTexts="FitInInput" DropDownWidth="210px" MaxHeight="400px">
</telerik:RadComboBox>

It has some default values selected on page load. Then I change the values of a different combobox and click the search button.

Somehow the OnTextChanged event of the combobox above is fired even though the text and the selected values have NOT changed, which causes the values of the second combobox to be changed again. Is this the designed behavior?

Ajax is enabled on the page and both comboboxes are in the AjaxControls of the button.

Any help will be appreciated.
Ivan Danchev
Telerik team
 answered on 17 Mar 2015
1 answer
157 views
hello all!
i have rad grid with 14 columns 

on low resulution i want to show it in normal mode so user can read

here is my grid config in untitled.png

when i set mastertable to tablelayout to fixed

it not shows right check grid.png

how to fix this problem?? i want to minimize grid or columns or spacing 

 regards R01











Galin
Telerik team
 answered on 17 Mar 2015
1 answer
109 views
Please help me to remove extra column kind of thing from radgrid.
find the attachment.
Angel Petrov
Telerik team
 answered on 17 Mar 2015
4 answers
1.2K+ views
Hi,

I am creating a radgrid dynamically and in that grid i have two columns whit same name and now i want to merge that column in one column and i want to merge cells as well.

Please check attachment for detail.

Please help urgently.
Pavlina
Telerik team
 answered on 17 Mar 2015
1 answer
92 views
I have kendo grid as follows
    <script>
            $(document).ready(function () {
                $.support.cors = true;

                var url = "url";

                $("#grid").kendoGrid({
                    dataSource: {
                        type: "json",
                        transport: {
                            read: url
                        },
                        schema: {
                            model: {
                                fields: {
                                    ResourceName: { type: "string" },
                                    ProjectName: { type: "string" },
                                    WeekOneUtilization: { type: "number" },
                                    WeekTwoUtilization: { type: "number" },
                                    WeekThreeUtilization: { type: "number" },
                                    WeekFourUtilization: { type: "number" },
                                }
                            }
                        },
                        group: {
                            field: "ResourceName",
                            aggregates: [
                               { field: "WeekOneUtilization", aggregate: "sum" },
                                { field: "WeekTwoUtilization", aggregate: "sum" },
                                 { field: "WeekThreeUtilization", aggregate: "sum" },
                                  { field: "WeekFourUtilization", aggregate: "sum" }
                            ]
                        },
                        aggregate: [{ field: "ProjectName", aggregate: "count" },
                                    { field: "WeekOneUtilization", aggregate: "sum" },
                                { field: "WeekTwoUtilization", aggregate: "sum" },
                                 { field: "WeekThreeUtilization", aggregate: "sum" },
                                  { field: "WeekFourUtilization", aggregate: "sum" }]
                    },
                    height: '100%',
                    width: 500,
                    columns:
                        [
                            {
                                field: "ResourceName",
                                title: "Resource Name",
                                width: 225
                            },
                        {
                            field: "ProjectName",
                            title: "Project Name",
                            width: 100
                        },
                            {
                                field: "WeekOneUtilization",
                                title: "@weekOneDisplayName",
                                width: 100,
                                aggregates: ["sum"],
                                //footerTemplate: "Total Utilization: #=sum#",
                                groupFooterTemplate: "Individual Utilization: #=sum#"
                            },
                              {
                                  field: "WeekTwoUtilization",
                                  title: "@weekTwoDisplayName",
                                  width: 100,
                                  aggregates: ["sum"],
                                  //footerTemplate: "Total Utilization: #=sum#",
                                  groupFooterTemplate: "Individual Utilization: #=sum#"
                              },
                                {
                                    field: "WeekThreeUtilization",
                                    title: "@weekThreeDisplayName",
                                    width: 100,
                                    aggregates: ["sum"],
                                    //footerTemplate: "Total Utilization: #=sum#",
                                    groupFooterTemplate: "Individual Utilization: #=sum#"
                                },
                                  {
                                      field: "WeekFourUtilization",
                                      title: "@weekFourDisplayName",
                                      width: 100,
                                      aggregates: ["sum"],
                                      //footerTemplate: "Total Utilization: #=sum#",
                                      groupFooterTemplate: "Individual Utilization: #=sum#"
                                  },
                        ]
                });

            });
        </script>

I want to add new column to the group footer with the sum of all four week sum. How can I achieve that in kendo grid
Kiril Nikolov
Telerik team
 answered on 17 Mar 2015
1 answer
188 views
Anyone,
I am using a RadGrid that contains one DetailTable as in the below code. I am binding the datasource for the grid in the NeedDataSource Event (need to do this way). I need to Expand all the items to show up the details table, on the page load (first time load); i am not sure when to expand the items. I tried doing it on the NeedDataSource event, but it doesn't work.

Please note: I have a asp button on the page for collapsing all the grid items. So i am unable to use the PreRender event as well. 

Can someone please suggest how do i go about this scenario?


<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
        AllowSorting="False" AllowMultiRowSelection="False" AllowPaging="False" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind" Skin="Default">       
        <MasterTableView DataKeyNames="col1" ExpandCollapseColumn-ButtonType="PushButton">
            <DetailTables>
                <telerik:GridTableView Name="detailGrid" Width="95%" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center">
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="col1" HeaderButtonType="TextButton" DataField="col1" />
                        <telerik:GridBoundColumn HeaderText="col2" HeaderButtonType="TextButton" DataField="col2" />                        
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
.....

A
Top achievements
Rank 1
 answered on 16 Mar 2015
1 answer
64 views
And my endless problems from server created controls continue.

I have users that are in different groups and each group has different user information. I am creating a page to manage users in a group using a Telerik RadGrid. Because of the unknown nature of the grid columns I am creating the grid on completely on the server.  You cannot have a grid defined in the aspx page and add columns in the server aspx.cs code, all kinds of things break like sorting, filters and extra text added.  The grid works fine.  

A feature I need is to output excel files with the grid's data. The problem, how do I reference the grid in server calls backs. If you look at Grid Export To Excel there is a button callback that changes grid values on the server and initiates the excel export on the grid control in ImageButton_Click.  In my case RadGrid1 is created in the server in the Page_Init and added to an asp:PlaceHolder. 

Is there any way to reference a server added control back in the server aspx.cs code.  Putting the control id will not compile.

I am going to want deal with Row Selected values which will also need server intervention dealing with the selected rows.

Thanks,
George
George
Top achievements
Rank 2
 answered on 16 Mar 2015
3 answers
258 views
Dear Sir,

There is user requirement to using combobox with checkbox for mulit-selection of code.  If "top 10" was removed the combobox didn't show any record. After check that, there are almost 7xxx records, do you mean that the combobox with checkbox with max. limitation of the record? If yes, what is the max. number of the records?
There is the code:
.aspx
 <telerik:RadComboBox runat="server" ID="cboSupplier" 
      CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
      AutoPostBack="false" CssClass="comboBoxStyle"
      DataTextField="SUPCD"
      
     EnableLoadOnDemand="True"  Height="200px" Width="95%">
</telerik:RadComboBox> 

.vb
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 If Not Me.IsPostBack Then
 LoadSupplier()
end if
End Sub
  Protected Sub LoadSupplier()
        cboSupplier.Items.Clear()
        Dim dbConn As New SqlConnection(WebConfigurationManager.ConnectionStrings("PDBConnectionString").ConnectionString)
        Dim adapter As New SqlDataAdapter("SELECT top 10 RTRIM(MSUP_SUPCD) MSUP_SUPCD,RTRIM(MSUP_SUPNM) MSUP_SUPNM FROM MSUP_TBL Group by RTRIM(MSUP_SUPCD) ,RTRIM(MSUP_SUPNM) ORDER By MSUP_SUPCD ", dbConn)
        Dim dt As New DataTable()
        adapter.Fill(dt)
        cboSupplier.DataTextField = "MSUP_SUPCD"
        cboSupplier.DataValueField = "MSUP_SUPCD"
        cboSupplier.DataSource = dt
        cboSupplier.DataBind()
        ' Insert the first item.
        cboSupplier.Items.Insert(0, New RadComboBoxItem("", ""))
    End Sub








Nencho
Telerik team
 answered on 16 Mar 2015
1 answer
79 views
When using LoadSettings() with an OpenAccessLinqDataSource be careful to specify DataSourceControlID="MyOpenAccessLinqDataSource" and not FilterContainerID="MyRadGrid".

If you're not using LoadSettings(), the RadFilter works OK with both strategies but if you're using a OpenAccessLinqDataSource and doing LoadSettings() then you must make the RadFilter element's DataSourceControlID attribute to refer to your datasource.

The demo for the Loading and saving of filter expressions uses a SQL data source and makes the filter point to the grid:

<telerik:RadFilter runat="server" ID="RadFilter1" FilterContainerID="RadGrid1"></telerik:RadFilter>

If instead of a SQL data source, you use a OpenAccessLinqDataSource, strange things will happen to the queries. For some reason, the query will be run a first time and then a second time but with the filter appearing *double* (where mycolumn = 1 and mycolumn = 1).

It won't fail but naturally, you don't want to execute your queries twice.

Also, visible during debug:
- in the output, a SqlSyntaxError error is thrown
- the _Selecting() event handler of the data source is called twice; the first time the data source's where property shows the correct where clause (as defined by the RadFilter that was set using LoadSettings() ); the second time with the radfilter's conditions repeated.

I found that declaring RadFilter as seen in the demo for integration with the data source works :

<telerik:RadFilter runat="server" ID="RadFilter1" 
  DataSourceControlID="EntityDataSourceCustomers" 
 OnApplyExpressions="RadFilter1_ApplyExpressions">
</telerik:RadFilter>

NOTE: I am not sure if this behaviour is specific to OpenAccessLinqDataSource or if it also happens with the SQL source. I didn't check.
Vasil
Telerik team
 answered on 16 Mar 2015
16 answers
417 views
Hello,

I have a grid whose items I am always keeping in edit mode. But I've noticed that certain operations (such as column sorting, for example), causes the edit items to revert back to browse mode. To avoid this, I handle the grid commands explicitly, and set the grid back to edit mode once the command has executed.

Here is my declaration of the grid:
<telerik:RadGrid ID="dtgBuildingSizes" runat="server" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" ShowFooter="true"
    AutoGenerateColumns="false" EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true" PageSize="5"
    AllowMultiRowEdit="true" Width="100%" EnableLinqExpressions="false"
    OnNeedDataSource="dtgBuildingSizes_NeedDataSource" OnItemDataBound="dtgBuildingSizes_ItemDataBound"
    OnPreRender="dtgBuildingSizes_PreRender" OnItemCommand="dtgBuildingSizes_ItemCommand">
    <MasterTableView DataKeyNames="Id" EditMode="InPlace" IsFilterItemExpanded="false">
        <Columns>
            <telerik:GridBoundColumn UniqueName="SizeTypeDescr" DataField="SizeTypeDescr" HeaderText="<%$ Resources: SizeType %>" ReadOnly="true" />
            <telerik:GridNumericColumn UniqueName="Size" DataField="Size" DataType="System.Decimal" ItemStyle-HorizontalAlign="Right"
                HeaderStyle-HorizontalAlign="Right" HeaderText="<%$ Resources:RpaControlCaptions, lblSize %>" />
            <telerik:GridButtonColumn UniqueName="Delete" CommandName="Delete" ButtonCssClass="rgDel" ButtonType="LinkButton"
                    ItemStyle-HorizontalAlign="Right" ShowInEditForm="true"
                    ConfirmText="<%$ Resources: AreYouSureYouWantToDeleteThisSize %>" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

And here is the relevant C# code:
protected void dtgBuildingSizes_PreRender(object sender, EventArgs e)
{
    //initially set appropriate size grid rows to edit mode
    if (!IsPostBack)
        dtgBuildingSizes.SetSizesGridToEditMode();
}
 
protected void dtgBuildingSizes_NeedDataSource(object sender, TelerikUI.GridNeedDataSourceEventArgs e)
{
    var dataSource = ((BuildingEntity)CurrentBusinessEntity).Sizes;
    dtgBuildingSizes.DataSource = dataSource;
    dtgBuildingSizes.VirtualItemCount = dataSource.Count;
}
 
protected void dtgBuildingSizes_ItemDataBound(object sender, TelerikUI.GridItemEventArgs e)
{
    if (e.Item is TelerikUI.GridDataItem)
    {
        TelerikUI.GridDataItem dataItem = (TelerikUI.GridDataItem)e.Item;
 
        //show/hide delete button based on availability for the size type
        BuildingSizeEntity entity = (BuildingSizeEntity)dataItem.DataItem;
        dataItem["Delete"].Controls[0].Visible = entity.IsDeletable;
    }
}
 
protected void dtgBuildingSizes_ItemCommand(object sender, TelerikUI.GridCommandEventArgs e)
{
    switch (e.CommandName)
    {
        case RadGrid.DeleteCommandName:
            if (e.Item is TelerikUI.GridDataItem)
            {
                //remove the selected entity from the collection
                TelerikUI.GridDataItem dataItem = (TelerikUI.GridDataItem)e.Item;
                BuildingSizeEntity deletedEntity = GetSizeEntityForGridItem(dataItem);
                ((BuildingEntity)CurrentBusinessEntity).Sizes.Remove(deletedEntity);
            }
            break;
        default:
            if (ControlsUtil.IsRebindNeededForRadGridCommand(e.CommandName))
            {
                //save previous edits before rebind
                PostAllSizeData();
 
                //execute command and place grid back into edit mode
                e.ExecuteCommand(sender);
                dtgBuildingSizes.SetSizesGridToEditMode();
 
                e.Canceled = true//no further processing required
            }
            break;
    }
}
 
public static bool IsRebindNeededForRadGridCommand(string commandName)
{
    switch (commandName)
    {
        // Editing
        case RadGrid.CancelAllCommandName:
        case RadGrid.CancelCommandName:
        case RadGrid.DeleteCommandName:
        case RadGrid.DeleteSelectedCommandName:
        case RadGrid.EditAllCommandName:
        case RadGrid.EditCommandName:
        case RadGrid.EditSelectedCommandName:
        case RadGrid.InitInsertCommandName:
        case RadGrid.PerformInsertCommandName:
        case RadGrid.UpdateCommandName:
        case RadGrid.UpdateEditedCommandName:
 
        // Filtering
        case RadGrid.ClearFilterCommandName:
        case RadGrid.FilterCommandName:
        case RadGrid.HeaderContextMenuFilterCommandName:
 
        // Paging
        case "ChangePageSize":
        case RadGrid.FirstPageCommandArgument:
        case RadGrid.LastPageCommandArgument:
        case RadGrid.NextPageCommandArgument:
        case RadGrid.PageCommandName:
        case RadGrid.PrevPageCommandArgument:
 
        // Sorting
        case RadGrid.ClearSortCommandName:
        case RadGrid.SortCommandName:
 
        // Misc.
        case RadGrid.ExpandCollapseCommandName:
        case RadGrid.RebindGridCommandName:
            return true;
        default:
            return false;   //all others do not implicitly call rebind
    }
}
 
public static void SetSizesGridToEditMode(this RadGrid grid)
{
    if (grid != null)
    {
        SizeEntity size;
        foreach (GridDataItem dataItem in grid.Items)
        {
            size = dataItem.DataItem as SizeEntity;
            if (size != null)
                dataItem.Edit = !size.IsReadOnly;   //only set editable items to edit mode
        }
 
        grid.Rebind();
    }
}

This works perfectly for all grid commands with the exception of the command to change the page size. When I call ExecuteCommand( ) for the GridPageSizeChangedEventArgs object (e) passed in, it throws a NullReferenceException, causing the action to fail.

How can I execute the page size event and keep my grid items always in edit mode? I realize that I can workaround this by removing the "default" case from the ItemCommand event handler and by removing the "if (!IsPostBack)" check from the grid's PreRender event handler, but I don't want to rebind the grid twice (first for the initial items, then again for setting each item to edit mode) every time the grid has to be rendered. I've noticed that this approach significantly slows down performance, especially when there are many grids being rebound several times each for each postback.

Is there a way I can get around this exception? Or alternatively, is there another way to ensure that the grid items are always in edit mode that doesn't require binding the grid twice?

Thanks!
Geoff
Pavlina
Telerik team
 answered on 16 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?