Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
191 views
I have a RadGrid with NeedDataSource binding.  It also has an EditTemplate. The following code works well for saving the users updates except that the EditTemplate doesn't close. How do I close the EditTemplate?

protected void ModelGrid_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.UpdateEditedCommandName)
            {
                if (e.Item is GridEditFormItem)
                {
                    GridEditFormItem item = (GridEditFormItem)e.Item;
                    string id = item.GetDataKeyValue("ModelId").ToString();
                    if (!String.IsNullOrEmpty(id))
                    {

                        Model m = new Model();
                        try
                        {
                            m.ModelId = id;
                            m.ManufacturerId = SelctedManufacturerId;
                            m.ModelNumber = ((TextBox)item.FindControl("txtEditModelNumber")).Text;
                            m.Description = ((TextBox)item.FindControl("txtEditDescription")).Text;
                            m.ProductLineId = ((RadComboBox)item.FindControl("ddlProductLine")).SelectedValue;
                            m.AssetTypeId = ((RadComboBox)item.FindControl("ddlAssetType")).SelectedValue;
                            m.DefAssetPosition = int.Parse(((DropDownList)item.FindControl("ddlDefAssetPos")).SelectedValue);

                            m.UseRackUnits = ((CheckBox)item.FindControl("chkUseRack")).Checked;
                            m.Height = (Double)((RadNumericTextBox)item.FindControl("numEditHeight")).Value;
                            m.Width = (Double)((RadNumericTextBox)item.FindControl("numEditWidth")).Value;
                            m.Depth = (Double)((RadNumericTextBox)item.FindControl("numEditDepth")).Value;

                            AssetVueBLL.UpdateModel(m, MySession.Current.UserId);
                            ModelGrid.Rebind();
                            
                        }
                        catch (Exception ex)
                        {
                            ModelGrid.Controls.Add(new LiteralControl("<strong>Unable to save Model</strong> - " + ex.Message));
                            e.Canceled = true;
                        }
                    }
                }
            }
        }
Tsvetoslav
Telerik team
 answered on 01 May 2013
1 answer
185 views
I have a RadGrid with a  NeedDataSource binding.  The grid also has an EditTemplate.  The update is working well, but on hitting Add New Item, I'm getting errors binding to the edit controls because there is no default value.  The dropdownlist errors because the selectedvalue of "" is not in the list.  When I fix that by adding a blank item to the list (which I really don't want) the RadNumericEdit errors because "" can't be converted to a double.  How do I set default values?
Tsvetoslav
Telerik team
 answered on 01 May 2013
1 answer
97 views

In the demo ODataDataSource - Filtering, Sorting and Paging with RadGrid, the paging does not work as expected.  The page size can be changed, but it does not "stick" as you move between pages.  For example, change the page size to 10 and move to the second page and you will find that while 10 is still the page size shown on the grid, that 20 rows are shown.

I noticed this bug in my own code and traced it back to how the demo worked.  I have not yet solved the issue (despite the fact that it looks like there is an easy fix when you examine the code).  Can you provide any guidance on this issue and then get the demo fixed so this bug doesn't spread all around the internet as people copy the demo code? Thanks. :)
Pavlina
Telerik team
 answered on 30 Apr 2013
0 answers
100 views
I have a Checkbox in DetailItemTemplate in a RadGrid.  I am triggering an AjaxRequest with javascript

How can I get each checkbox value in my event? [protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)]

I have a button called "delete checked".  I have several other action I run thru by sending different arguments, not sure how to handle this one. Would I loop thru the rows?

Any direction?

Thanks,

Marty

SOLVED: 
List<string> selectedItems = new List<string>();
                foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
                {
                    RadButton DelCheck = item.DetailTemplateItemDataCell.FindControl("DelCheck") as RadButton;
                    if (DelCheck.Checked)
                    {
                        selectedItems.Add(DelCheck.CommandArgument);
                    }
                }



moegal
Top achievements
Rank 1
 asked on 30 Apr 2013
0 answers
150 views

After my user drags a column to be grouped (i.e. client, sales person) it generates a summary value (order total) in the group footer.  I want to sort the grouped results by that summary value that shows up in the footer.

Looking for results like this:

Client         Total Amount
ABC Corp   $1000
ABC Corp   $1500
                   $2500

XYZ LLC     $2000
XYZ LLC     $1750
                    $3750

LMN Inc      $4500
                    $4500

If this helps, my static radgrid definition is as follows:

<telerik:RadGrid ID="rgOrders" ShowGroupPanel="True" Width="1300px" Height="750px"
                AutoGenerateColumns="False" AllowPaging="True" PageSize="25" AllowSorting="True"
                runat="server" OnNeedDataSource="rgOrders_NeedDataSource" Skin="WebBlue" OnItemCommand="rgOrders_ItemCommand"
                AllowFilteringByColumn="False" CellSpacing="0" ShowFooter="true" GridLines="None"
                OnItemDataBound="rgOrders_ItemDataBound">
                <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"
                    HideStructureColumns="true">
                </ExportSettings>
                <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" AllowGroupExpandCollapse="True"
                    ReorderColumnsOnClient="True" AllowDragToGroup="True">
                    <Scrolling AllowScroll="False" UseStaticHeaders="True" />
                    <Resizing AllowColumnResize="true" AllowRowResize="true" />
                </ClientSettings>
                <MasterTableView CommandItemDisplay="Top" EnableLinqGrouping="false" ShowGroupFooter="True">
                    <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true"
                        ShowExportToCsvButton="true" ShowExportToPdfButton="true" ShowAddNewRecordButton="false" />
                    <Columns>
                        <telerik:GridTemplateColumn HeaderText="Edit" ItemStyle-HorizontalAlign="Center"
                            ItemStyle-Width="40" HeaderStyle-Width="40">
                            <ItemTemplate>
                                <asp:imagebutton id="ibtnUpdate" commandname="Edit" runat="server" imageurl="images/silk/pencil_go.png" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Order Summary" ItemStyle-HorizontalAlign="Center"
                            ItemStyle-Width="60" HeaderStyle-Width="60">
                            <ItemTemplate>
                                <asp:imagebutton id="ibtnView" commandname="View" runat="server" imageurl="images/1258747021_old-edit-find.png" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Set Location" ItemStyle-HorizontalAlign="Center"
                            ItemStyle-Width="60" HeaderStyle-Width="60">
                            <ItemTemplate>
                                <asp:imagebutton id="ibtnLocation" commandname="Location" runat="server" imageurl="images/1366329632_map.png" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="ClientName" ItemStyle-Width="200px" HeaderStyle-Width="200"
                            FilterControlAltText="Filter ClientName column" HeaderText="Client Name" ReadOnly="True"
                            AllowFiltering="false" SortExpression="ClientName" UniqueName="ClientName" AutoPostBackOnFilter="false"
                            CurrentFilterFunction="EqualTo" FilterDelay="4000" ShowFilterIcon="True" />
                        <telerik:GridBoundColumn DataField="OrderID" ItemStyle-Width="75px" HeaderStyle-Width="75px"
                            FilterControlAltText="Filter OrderID column" HeaderText="Order ID" ReadOnly="True"
                            AllowFiltering="false" SortExpression="OrderID" UniqueName="OrderID" />
                        <telerik:GridBoundColumn DataField="OrderDate" DataFormatString="{0:MM/dd/yyyy}"
                            ItemStyle-Width="75px" HeaderStyle-Width="75px" FilterControlAltText="Filter OrderDate column"
                            HeaderText="Order Date" ReadOnly="True" AllowFiltering="True" SortExpression="OrderDate"
                            UniqueName="OrderDate" />
                        <telerik:GridNumericColumn Aggregate="Sum" AllowSorting="true"  DataField="TotalAmount" DataFormatString="{0:C}"
                            ItemStyle-Width="75px" HeaderStyle-Width="75px" FilterControlAltText="Filter TotalAmount column"
                            HeaderText="Total MRR" ReadOnly="True" AllowFiltering="True" SortExpression="TotalAmount"
                            UniqueName="TotalAmount" ItemStyle-HorizontalAlign="Right" />
                        <telerik:GridNumericColumn Aggregate="Sum" AllowSorting="true" DataField="NRC" DataFormatString="{0:C}"
                            ItemStyle-Width="75px" HeaderStyle-Width="75px" FilterControlAltText="Filter NRC column"
                            HeaderText="Total NRC" ReadOnly="True" AllowFiltering="True" SortExpression="NRC"
                            UniqueName="NRC" ItemStyle-HorizontalAlign="Right" />
                        <telerik:GridBoundColumn DataField="OrderStatus" ItemStyle-Width="75px" HeaderStyle-Width="75px"
                            FilterControlAltText="Filter OrderStatus column" HeaderText="Order Status" ReadOnly="True"
                            AllowFiltering="false" SortExpression="OrderStatus" UniqueName="OrderStatus" />
                        <telerik:GridTemplateColumn HeaderText="Invoiced?" ItemStyle-Width="70px" HeaderStyle-Width="70px">
                            <ItemTemplate>
                                <%# GetYesNo(Eval("Invoiced"))%>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="OrderTrialType" ItemStyle-Width="50px" HeaderStyle-Width="50px"
                            FilterControlAltText="Filter OrderTrialType column" HeaderText="Order Trial?"
                            ReadOnly="True" AllowFiltering="false" SortExpression="OrderTrialType" UniqueName="OrderTrialType" />
                        <telerik:GridBoundColumn DataField="FullName" ItemStyle-Width="100px" HeaderStyle-Width="100px"
                            FilterControlAltText="Filter FullName column" HeaderText="Sales Rep" ReadOnly="True"
                            AllowFiltering="false" SortExpression="FullName" UniqueName="FullName" />
                        <telerik:GridBoundColumn DataField="FirmOrderDeliveryDate" DataFormatString="{0:MM/dd/yyyy}"
                            ItemStyle-Width="75px" HeaderStyle-Width="75px" FilterControlAltText="Filter FirmOrderDeliveryDate column"
                            HeaderText="Target Delivery Date" ReadOnly="True" AllowFiltering="false" SortExpression="FirmOrderDeliveryDate"
                            UniqueName="FirmOrderDeliveryDate" />
                        <telerik:GridBoundColumn DataField="ContractStartDate" DataFormatString="{0:MM/dd/yyyy}"
                            ItemStyle-Width="75px" HeaderStyle-Width="75px" FilterControlAltText="Filter ContractStartDate column"
                            HeaderText="Contract Start Date" ReadOnly="True" AllowFiltering="false" SortExpression="ContractStartDate"
                            UniqueName="ContractStartDate" />
                        <telerik:GridBoundColumn DataField="ContractEndDate" DataFormatString="{0:MM/dd/yyyy}"
                            ItemStyle-Width="75px" HeaderStyle-Width="75px" FilterControlAltText="Filter ContractEndDate column"
                            HeaderText="Contract End Date" ReadOnly="True" AllowFiltering="false" SortExpression="ContractEndDate"
                            UniqueName="ContractEndDate" />
                        <telerik:GridBoundColumn DataField="PM_Name" ItemStyle-Width="100px" HeaderStyle-Width="100px"
                            FilterControlAltText="Filter PM_Name column" HeaderText="Prov. Mgr" ReadOnly="True"
                            AllowFiltering="false" SortExpression="PM_Name" UniqueName="FullPM_NameName" />
                        <telerik:GridBoundColumn DataField="BillingFrequency" FilterControlAltText="Filter BillingFrequency column"
                            HeaderText="Billing Frequency" ReadOnly="True" AllowFiltering="false" SortExpression="BillingFrequency"
                            UniqueName="BillingFrequency" />
                        <telerik:GridButtonColumn ConfirmText="Mark Inactive?" ConfirmDialogType="RadWindow"
                            ItemStyle-Width="50" HeaderStyle-Width="50" ConfirmTitle="Mark Inactive?" ButtonType="ImageButton"
                            CommandName="MakeInactive" Text="Mark Inactive?" UniqueName="MarkInactiveColumn"
                            ImageUrl="images/1263447248_cross.png">
                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <GroupingSettings ShowUnGroupButton="true" />
                <PagerStyle PageSizes="25,50,100,250 " />
            </telerik:RadGrid>


Any help is appreciated.  Thanks.
Hunter

Hunter
Top achievements
Rank 1
 asked on 30 Apr 2013
1 answer
150 views
I have a rad grid with rows that contain radnumeric textboxes.
When the user updates or enter a value in the textbox, i need the radgrid row to be selected client side.

NOTE: When the textbox is databound (server side) I am adding a onblur javascript event. 

Any ideas?


<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" UniqueName="TemplateColumn" HeaderText="Copies to Order">
<ItemmTemplate>
        <telerik:RadNumericTextBox ID="CopiesToOrderRadNumericTextbox" runat="server" Culture="en-US" DbValueFactor="1" LabelWidth="64px" MinValue="0" Width="70px" DbValue='<%# DataBinder.Eval(Container.DataItem,"CopiesOrdered") %>' DataType="System.Int32">
                 <NumberFormat DecimalDigits="0" GroupSeparator="" ZeroPattern="n" />
</telerik:RadNumericTextBox>
 
</ItemTemplate>
</telerik:GridTemplateColumn>
Wired_Nerve
Top achievements
Rank 2
 answered on 30 Apr 2013
7 answers
766 views
Hi fellow coders,

Am using the radGrid to display grouped data. I also have aggregated data for the group (sum) on some columns. I would want to format the totals at the group footer to my own liking, e.g. make font bold, use different background color, etc. How do I go about formatting the group footer text?

Please see attached image for some visual explanation.

Thanks.
Mike
Top achievements
Rank 1
 answered on 30 Apr 2013
0 answers
83 views
Cancel this entry.  The problem has changed.  Thanks.

I've been looking at your scenarios for creating RadWindow popups from the RadGrid.  (http://www.telerik.com/help/aspnet-ajax/grid-window-editing.html)

Assuming this basic model for generating the RadWindow itself from the main screen:

1. Is it essential to use a DetailsView in the RadWindow for this scenario or can any updating/inserting code and controls be substituted?

2. Is it possible to put a separate RadAjaxManager in the RadWindow form itself to handle relationships between various controls?  (i.e. Dropdown1 triggering an update of Dropdown2.)

Let's just cancel this one.  I've managed to create a popup scheme without use of DetailViews.
Boris
Top achievements
Rank 1
 asked on 30 Apr 2013
1 answer
215 views
Hi,

I want to show an empty message in telerik html chart.

Danail Vasilev
Telerik team
 answered on 30 Apr 2013
2 answers
178 views
In reference to a previous thread about the same topic , but the user seems to have had the answer in a support ticket and it wasn't published for the rest of the users on the forum to benefit from.

Kindly help me resolve this problem. I have a repeater that contains dynamic linkbuttons which perform a certain function server-side. I referenced that repeater in the AjaxManager settings and configured its updatedcontrols, however, the behavior is random!!

Sometimes it performs ajax requests when clicking on one of those linkbuttons, and some other times out of no where, it performs a full postback :S there is no specific pattern to it and am at my wits with trial and error.

Please help :(
Omar
Top achievements
Rank 2
 answered on 30 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?