I want to update my ASPx grid view footer for that I need to access TotalSummary on server side can any one help me on same.
I am fetching data as expected but after delete i need to update current value present in Aspx Grid view
ASPX
<td>
<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" cellstyle-horizontalalign="Center" OnHtmlFooterCellPrepared="grid_HtmlFooterCellPrepared"
KeyFieldName="Ref_ID" OnCustomCallback="grid_CustomCallback" SettingsPager-Mode="ShowAllRecords" Width="100%">
<Columns>
<dx:GridViewDataColumn FieldName="Ref_ID" VisibleIndex="0" Caption="Process No" CellStyle-CssClass="align-text-left"></dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Depot" VisibleIndex="0"></dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="CostCenter" VisibleIndex="1"></dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="GL" VisibleIndex="3"></dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Customer" VisibleIndex="4"></dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="PriceGroup" VisibleIndex="5"></dx:GridViewDataColumn>
</Columns>
<Settings ShowFooter="true" />
<TotalSummary>
<dx:ASPxSummaryItem FieldName="ProductValueLC" ShowInGroupFooterColumn="ProductValueLC" SummaryType="Sum" DisplayFormat="Total: {0:###,##.00}" />
<dx:ASPxSummaryItem FieldName="ProductValueSR" ShowInGroupFooterColumn="ProductValueSR" SummaryType="Sum" DisplayFormat="Total: {0:###,##.00}" />
<dx:ASPxSummaryItem FieldName="QTYInPieces" ShowInGroupFooterColumn="QTYInPieces" SummaryType="Sum" DisplayFormat="Total: {0}" />
</TotalSummary>
<Settings ShowGroupPanel="true" />
</dx:ASPxGridView>
</td>
I want to update current value which is present in grid
The DevExpress docs contains several approaches to access TotalSummary on server side. One way it´s appropriate for your case is a GridView event called CustomSummaryCalculate.
Related
I new to telerik and fighting my way up the learning curve.
I have a RadGrid that I'm populating with a linq query. I'm using a
GridTemplateColumn with a ComboBox for new and edit of one of the fields. The problem is the ComboBox doesn't show on the insert or edit screen. The fields set as GridDropDownColumn do show on the insert or edit. I need GridTemplateColumn solution because I need to run some code once the dropdown list has been selected.
What am I missing here? I'm trying to work from a Telerik example. It's the Release field that is giving me the problem.
<telerik:RadGrid RenderMode="Lightweight" ID="grdData" runat="server"
AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
AllowAutomaticInserts="true"
AllowAutomaticUpdates="true"
OnNeedDataSource="grdData_OnNeededDataSource"
OnItemDataBound="grdData_OnItemDataBound"
OnUpdateCommand="grdData_OnUpdateCommand" >
<ClientSettings>
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<SelectedItemStyle BackColor="LightYellow" />
<MasterTableView Width="100%"
DataKeyNames="TID"
EditMode="EditForms"
AutoGenerateColumns="false"
InsertItemDisplay="Top"
CommandItemDisplay="Top"
InsertItemPageIndexAction="ShowItemOnFirstPage">
<Columns>
<telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="TID" UniqueName="TID"
HeaderText="TID" ReadOnly="true"></telerik:GridBoundColumn>
<telerik:GridDropDownColumn UniqueName="Employee" ListDataMember="Employee"
SortExpression="Employee" ListTextField="Employee" ListValueField="Employee"
HeaderText="Employee" DataField="Employee"
DropDownControlType="RadComboBox"
EnableEmptyListItem="true" EmptyListItemText="Make a choice" EmptyListItemValue=""
/>
<telerik:GridDropDownColumn UniqueName="Job" ListDataMember="Job"
SortExpression="Job" ListTextField="Job" ListValueField="Job"
HeaderText="Job" DataField="Job"
DropDownControlType="RadComboBox"
EnableEmptyListItem="true" EmptyListItemText="Make a choice" EmptyListItemValue=""
/>
<telerik:GridTemplateColumn UniqueName="Release"
HeaderText="Release"
HeaderStyle-HorizontalAlign="Center"
SortExpression="Release"
ItemStyle-Width="170px" HeaderStyle-Width="80px"
DataField="Release" >
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "Release")%>
</ItemTemplate>
<telerik:EditItemTemplate>
<telerik:RadComboBox runat="server" ID="rcbRelease"
AutoPostBack="true"
EnableLoadOnDemand="true"
DataTextField="Release"
DataValueField="Release"
Text='<% #Bind("Release")%>'
EnableEmptyListItem="true"
EmptyListItemText="Make a choice"
EmptyListItemValue="NR"
OnDataBinding="rcbRelease_OnDataBinding"
></telerik:RadComboBox>
</telerik:EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="ComponentJob" UniqueName="ComponentJob" HeaderText="ComponentJob"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Operation" UniqueName="Operation" HeaderText="Operation"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Quantity" UniqueName="Quantity" HeaderText="Quantity"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Priority" UniqueName="Priority" HeaderText="Priority"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Status" UniqueName="Status" HeaderText="Status"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastEdit" UniqueName="LastEdit" HeaderText="LastEdit"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
I think your having trouble with the ComboBox because you have EnableLoadOnDemand=true but you have not subscribed to the ItemsRequested event. See Load On Demand Overview for details.
Since you mention your new to the controls, you might want to get the ComboBox LoadOnDemand working outside of the grid first.
Try removing the telerik namespace/prefix from the EditItemTemplate declaration:
Change this:
<telerik:EditItemTemplate>
<%-- RadComboBox --%>
</telerik:EditItemTemplate>
To this:
<EditItemTemplate>
<%-- RadComboBox --%>
</EditItemTemplate>
Also, please share with us which documentation were you following so that we can double check and report the documentation error.
I have created a GridView in Visual Studio 2010.
The information displayed in the GridView is controlled by a dropdown list.
Can I add a "Show all" option to the dropdown list so that the GridView shows all the data?
This is what I have so far...
Dropdown list
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="dorpDownList2" DataTextField="Type" DataValueField="Type" AppendDataBoundItems="true"
AutoPostBack="True">
<asp:ListItem Value="0" Text="Select a type"></asp:ListItem>
</asp:DropDownList>
GridView code
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ShowHeaderWhenEmpty="True" emptydatatext="No data was found.">
<Columns>
<asp:BoundField DataField="OrgName" HeaderText="Organisation"
SortExpression="OrgName" />
<asp:BoundField DataField="ProjectTitle" HeaderText="Project title"
SortExpression="ProjectTitle" />
<asp:BoundField DataField="Type" HeaderText="Type"
SortExpression="Type" />
<asp:BoundField DataField="Amount"
HeaderText="Amount" SortExpression="Amount"
DataFormatString="{0:c}" />
<asp:HyperLinkField DataNavigateUrlFields="OrgName"
DataNavigateUrlFormatString="orgDetails.aspx?OrgName={0}"
HeaderText="Details" Text="Organisation details" />
</Columns>
</asp:GridView>
SqlDataSource1
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
SelectCommand="SELECT [OrgName], [ProjectTitle], [Type], [Amount] FROM [tabRequest] WHERE [Type] = #Type">
</asp:SqlDataSource>
I can obviously add "Show all" to the drop down list using asp:ListItem but how do I add the functionality to make that actually show all the results?
Any help would be greatly appreciated.
Thanks,
James
The easiest way is via the Configure Data Source context menu. You already have a parameter, as you move through the configuration process you come to a dialog called Define Parameters. You should see "Type" listed in the Parameters list. Select it and change the Parameter source to "Control" and when prompted specify the DDL.
The trick is that you need to effectively remove the condition on your select where clause when Type is 0. This is easily done with an IF statement.
I have a obout grid in which right now i have included only one column.When I set the datasource and data bind it the grid shows as empty at runtime.I was doing it with the normal gridview(asp) earlier and it was working fine.I replaced the normal gridview with the obout - now its coming as empty.
<obout:Grid ID="gvReport" runat="server" Serialize="false" ShowTotalNumberOfPages="false" AllowPaging="true"
ShowLoadingMessage="false" FolderStyle="~/styles/premiere_blue" AllowPageSizeSelection="false" EnableRecordHover="true"
AllowGrouping="false" AutoGenerateColumns="false" AllowFiltering="false" FilterType="ProgrammaticOnly"
AllowAddingRecords="false" AllowColumnReordering="false" AllowRecordSelection="true" AllowMultiRecordSelection="true" ShowRecordsPerPage="false" AllowColumnResizing="true" ShowColumnsFooter="false" ShowHeader="true" ShowFooter="true" AllowSorting="true" GenerateRecordIds="True" ViewStateMode="Inherit" KeepSelectedRecords="true" CallbackMode="false"
EmbedFilterInSortExpression="true" Width="100%" PageSize="10" OnRowDataBound="GridView_RowDataBound" OnDataBound="GridView_DataBound" OnDataSourceNeeded="GridDataSourceNeededEvent">
<ScrollingSettings ScrollHeight="260" EnableVirtualScrolling="true" UsePagingForVirtualScrolling="true" /><Columns>
<obout:Column ID="colName" DataField="Name" Width="200px" Wrap="true" HeaderText="Content Name"
ShowFilterCriterias="false">
<TemplateSettings FilterTemplateId="tplNameFilter" />
<FilterOptions>
<obout:FilterOption IsDefault="true" Type="Contains" />
</FilterOptions>
</obout:Column>
</Columns>
<Templates>
<obout:GridTemplate runat="server" ID="tplNameFilter" ControlID="NameFilter">
<Template>
<obout:OboutTextBox runat="server" ID="NameFilter" Width="100%">
</obout:OboutTextBox>
</Template>
</obout:GridTemplate>
</Templates>
<TemplateSettings HeadingTemplateId="tplHeading" />
<PagingSettings PageSizeSelectorPosition="Bottom" Position="Bottom" ShowRecordsCount="True" />
<FilteringSettings InitialState="Hidden" FilterPosition="Top" FilterLinksPosition="Top" />
</obout:Grid>
Code:
gvReport.DataSource = reportData;
gvReport.DataBind();
While debugging the table has all the values but they are not getting assigned to the grid.Previously in place of obout I had normal gridview and it was working fine.
You must remove
OnDataSourceNeeded="GridDataSourceNeededEvent"
you can't have an OnDataSourceNeeded event togheter with gvReport.DataSource
I am retrieving data from database using RadGrid. I have more columns in my RadGrid, so I need to show RadGrid horizontal scroll to keep the page from expanding but disable the vertical scroll so height of the grid should expand to always display all rows in the grid. I got the result but there is whitespace in the bottom of the RadGrid.
My UI of the RadGrid:
<table style="table-layout: fixed;" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="false" PagerStyle-AlwaysVisible="true"
CellPadding="0" CellSpacing="0" GridLines="None" Skin="Metro" CssClass="RadGrid_CBGrid"
HorizontalAlign="Left" AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemCommand"
OnDataBound="RadGrid1_DataBound">
<ClientSettings>
<Selecting CellSelectionMode="SingleCell"></Selecting>
<Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling>
</ClientSettings>
<MasterTableView HierarchyLoadMode="Client" DataKeyNames="EmpID" AllowMultiColumnSorting="true"
Name="Parent">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="EmpID" EmptyDataText="NA" HeaderText="Emp ID"
UniqueName="EmpID">
</telerik:GridBoundColumn>
and so on......
-------------------
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
</td>
</tr>
</table>
If I changed ClientSettings-Scrolling-AllowScroll="true" in RadGrid and
I got the result and there is NO whitespace in the bottom of the RadGrid BUT Horizontal scroll bar is NOT coming in my RadGrid.
So can anybody please give me the solution.
Or if you don't want to worry about hieght calculation do this!
// radgrid scroll horizontal only
<ClientSettings AllowDragToGroup="True" AllowGroupExpandCollapse="true">
<Scrolling AllowScroll="true" />
<ClientEvents OnGridCreated="GridCreated" />
</ClientSettings>
function GridCreated(sender, args) {
$('.rgDataDiv').removeAttr('style');
$('.rgDataDiv').attr('style', 'overflow-x: scroll;');
}
Just change overflow-x property value of data grid to scroll , instead of applying auto. If you have this issue in IE9.
I have an issue working with the telerik radgrid control. I am trying to use javascript to access a textbox when the grid is in edit mode.
My code looks like the following:
<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True"
AllowSorting="False" AllowAutomaticInserts="True" PageSize="10" AllowAutomaticUpdates="True"
OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowEdit="False" AllowPaging="False"
DataSourceID="DataSource1" OnItemUpdated="RadGrid1_ItemUpdated" AllowFilteringByColumn="False"
OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" AutoGenerateColumns="false"
OnDataBound="RadGrid1_DataBound">
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="Id"
DataSourceID="DataSource1" HorizontalAlign="NotSet" EditMode="EditForms">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
<ItemStyle CssClass="MyImageButton" />
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
UniqueName="DeleteColumn">
<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="Id" HeaderText="Id" Display="false" ReadOnly="true" />
<telerik:GridBoundColumn DataField="Manufacturer" HeaderText="Manufacturer" />
<telerik:GridBoundColumn DataField="Description" HeaderText="Description" />
<telerik:GridBoundColumn DataField="Configuration" HeaderText="Configuration" />
<telerik:GridDropDownColumn DataField="TypeId" HeaderText="Type" UniqueName="PartsType"
DataSourceID="PartsTypeDataSource" ListTextField="Name" ListValueField="Id" />
What I am after is that, during edit mode, when the user selects a certain value from the dropdown list 'PartsType', one of the other fields - eg 'Manufacturer' will be shown/hide.
I could get the dropdown value (in javascript) by attaching a javascript function to the dropdownlist:
function PartsTypeIndexChanged(sender, args) {
var selectedValue = args.get_item()._text;
}
I just dont know which method to use to get the 'Manufacturer' field, so I can show/hide it.
Could anyone please help?
Many thanks.
A possible approach could be to use RadControls client-side static API
$telerik.findElement(gridDOMElement, "Manufacturer");
This will help you access the column editor - I suppose it is ASP.NET TextBox rendered as input. For numeric or date columns the editor will probably be Telerik client component so you have to use findControl instead of findElement.
More info here:
http://www.telerik.com/help/aspnet-ajax/telerik-static-client-library.html
Good luck
Please check below link.
http://www.telerik.com/community/forums/aspnet-ajax/grid/set-controls-attribute-like-enable-disable-on-insert-edit-mode-using-jquery.aspx