I have a multiple Parent-Child Gridview. The problem is Parent gridview Column name is Cost ($) and the ($) symbol is hiding when i expand the Child gridview and get it back when i minimize the Child gridview (Devexpress). The Parent-Child gridview is present in the AspxCallbackPanel and in the PopupControl.
<dx:ASPxCallbackPanel ID="cbpCartDetails" runat="server"
OnCallback="cbpCartDetails_Callback" ClientInstanceName="cbpCartDetails">
<ClientSideEvents EndCallback="cbpCartDetails_EndCallBack" />
<PanelCollection>
<dx:PanelContent ID="pnlCartDetails">
<dx:ASPxPopupControl ClientInstanceName="popCartDetails" Width="600px"
Height="250px" CloseAction="CloseButton" MaxWidth="800px" MaxHeight="800px"
MinHeight="150px" MinWidth="150px" ID="popCartDetails"
HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true"
runat="server" EnableViewState="false" PopupHorizontalAlign="WindowCenter"
PopupVerticalAlign="WindowCenter" EnableHierarchyRecreation="false"
Modal="true">
<ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl2"
runat="server">
<dx:ASPxGridView ID="grdBuildingCartEst" Width="100%"
Theme="SoftOrange" KeyFieldName="CarttypeId"
ClientInstanceName="grdBuildingCartEst">
<Columns>
<dx:GridViewDataTextColumn FieldName="CartType" />
<dx:GridViewDataTextColumn FieldName="NumberOfCart" />
<dx:GridViewDataTextColumn FieldName="Cost" />
</Columns>
<Templates>
<DetailRow>
<dx:ASPxGridView ID="grdFloorsCartEst"
Width="100%"
Theme="SoftOrange"
KeyFieldName="CarttypeId"
OnInit="grdFloorsCartEst_Init"
OnBeforePerformDataSelect=
"grdFloorsCartEst_BeforePerformDataSelect"
ClientInstanceName="grdFloorsCartEst">
<Columns>
<dx:GridViewDataTextColumn
FieldName="CartSize" />
<dx:GridViewDataTextColumn
FieldName="NumberOfCart" />
<dx:GridViewDataTextColumn
FieldName="Cost" />
</Columns>
</dx:ASPxGridView>
</DetailRow>
</Templates>
<SettingsDetail ShowDetailRow="true" />
</dx:ASPxGridView>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>
</dx:PanelContent>
</PanelCollection>
Screen shot 1
https://i.stack.imgur.com/Fb1QX.png
Screen shot 2 (Error)
https://i.stack.imgur.com/AghdG.png
notice, in the code you've posted, there is no "Cost ($)" string for the master grid column, only FieldName="Cost". Most probably "Cost ($)" is set to column header at codebehind during Page_Load or some other event.
When you expand the child grid there happens a callback and the event code at codebehind where you set Cost ($) is not executed. So, you need to make sure the column header of the master grid is set to "Cost ($)" during child grid expand callback. To be 100% sure, post/attach the codebehind part of your page/control to the question's text.
Related
I am very new to dev express .
<dx:ASPxGridView ID="aspxgvOMContracts" runat="server" KeyFieldName="OMContractId" Settings-UseFixedTableLayout="true"
AutoGenerateColumns="False" Settings-HorizontalScrollBarMode="Auto" Width="477px" Theme="PlasticBlue"
OnRowUpdating="aspxgvOMContracts_OnRowUpdating" OnRowUpdated="aspxgvOMContracts_OnRowUpdated">
<SettingsPager PageSize="5" />
<SettingsBehavior AllowFocusedRow="true" />
<SettingsEditing Mode="Inline" />
<%-- <Styles>
<CommandColumnItem Spacing="">
<Paddings PaddingLeft="7" PaddingRight="7" />
</CommandColumnItem>
</Styles>--%>
<Columns>
<dx:GridViewCommandColumn ButtonType="Image" Width="65px" VisibleIndex="0">
<EditButton Visible="True" Image-Url="../Content/Images/icon_edit.png">
</EditButton>
<UpdateButton Visible="True" Image-Url="../Content/Images/icon_update.png">
</UpdateButton>
<CancelButton Visible="true" Image-Url="../Content/Images/icon_cancel.png">
</CancelButton>
<DeleteButton Visible="true" Image-Url="../Content/Images/icon_delete.png">
</DeleteButton>
<ClearFilterButton Visible="True">
</ClearFilterButton>
<%-- <HeaderTemplate>
<dx:ASPxLabel ID="headerLabel" runat="server">
</dx:ASPxLabel>
</HeaderTemplate>--%>
</dx:GridViewCommandColumn>
<dx:GridViewDataComboBoxColumn FieldName="OrganisationName" Caption="OrganisationName" VisibleIndex="1">
<PropertiesComboBox TextField="CompanyName" ValueField="OrganisationId" ValueType="System.Int32">
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
<dx:GridViewDataTimeEditColumn FieldName="DateAnnounced" Caption="DateAnnounced" VisibleIndex="2">
</dx:GridViewDataTimeEditColumn>
<dx:GridViewDataTextColumn FieldName="Cost" Caption="Cost" VisibleIndex="3">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CostCurrency" Caption="Cost Currency" VisibleIndex="4">
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
and in code behind i Bind the data as
aspxgvOMContracts.DataSource = phase.OMContracts;
aspxgvOMContracts.DataBind();
here phase.OMContracts is of type List()
Now once I edit any row I need the modified collection back . How do I get the modified collection ?
You have assigned the DataSource Property of AspxGridview control then you can directly access that assigned assigned List from DataSource Property, it is a read and write property.
Check the documentation:
ASPxDataWebControlBase.DataSource Property
Gets or sets the object from which the data-bound control retrieves
its list of data items.
From: Get GridView data source to Data table
if you bind gridview on every postback..then you can get DataTable dt = GridView1.DataSource as DataTable;
Same for you alos as List<SomeType> data = grid.DataSource as List<SomeType>;
Hope this help..
ASP.net(C#), VS2010, Win 7.
New to WebDev, so this might be a simple syntax thing but here it goes...
Long story short I have to force a postback on a GridView that shows attachments I upload using an ASPxUploadControl. I put the GridView inside an ASPxCallbackPanel and am trying to get my GridView to update on the page after an attachment is uploaded using ASPxCallbackPanel.PerformCallback();
Here's the Upload control, in its' ClientSideEvent is where I'm trying to call the clientSideEvent from the Button shown below. Just trying to force a button click really, but I tried doing it from the code-behind but that didn't work. Any help would be appreciated!
<dxuc:ASPxUploadControl ID="FileUpload1" runat="server"
ClientInstanceName="uploader"
ShowAddRemoveButtons="False"
ShowUploadButton="True"
AddUploadButtonsHorizontalPosition="Center"
AddUploadButtonsVerticalPosition="Top" FileInputCount="1"
UploadMode="Advanced"
OnFileUploadComplete="UploadControl_FileUploadComplete"
Size="30">
<ClientSideEvents FileUploadComplete="function(s, e) { Button1.Click; }" />
<%-- <AdvancedModeSettings EnableMultiSelect="True" /> "does not have public property named "advancedModeSettings" version is too old--%>
<ValidationSettings
AllowedFileExtensions=".doc,.pdf,.xls,.txt,.jpeg,.jpg,.gif,.png,.oft,.htm,.html,.mht,.rtf,.zip"
MaxFileSize="5242880"
FileDoesNotExistErrorText="This file can't be found."
GeneralErrorText="Custom file uploading fails due to an external error that doesn't relate to the ASPxUploadControl's functionality"
MaxFileSizeErrorText="Size of the uploaded file exceeds maximum file size">
<ErrorStyle ForeColor="Red"/>
</ValidationSettings>
</dxuc:ASPxUploadControl>
Here is the GridView as well as a button I made that successfully refreshes the grid.
<div>
<dxe:ASPxButton ID="ASPxButton1" runat="server" ClientInstanceName="Button1" Text="Reload Panel" AutoPostBack="False">
<ClientSideEvents Click="function(s, e) {ASPxCallbackPanel1.PerformCallback(); e.processOnServer = true;}" />
</dxe:ASPxButton>
<dx:ASPxCallbackPanel ID="ASPxCallbackPanel1" runat="server"
ClientInstanceName="ASPxCallbackPanel1" Width="492px"
Height="100%">
<PanelCollection>
<dx:PanelContent runat="server">
<asp:GridView ID="gvAttachment" SkinID="grid" runat="server" Width="98%"
OnRowDataBound="AttachmentControl_OnRowDataBound"
meta:resourcekey="gvAttachResource1"
PagerSettings-FirstPageText="<%$ Resources:CommonControlText,FirstPageText %>"
PagerSettings-LastPageText="<%$ Resources:CommonControlText,LastPageText %>"
PagerSettings-PreviousPageText="<%$ Resources:CommonControlText,PreviousPageText %>"
PagerSettings-NextPageText="<%$ Resources:CommonControlText,NextPageText %>"
AutoGenerateColumns="False">
<EmptyDataRowStyle CssClass="emptyData" />
<EmptyDataTemplate>
<table class="usercontroldetail container_table">
<tr>
<td class="tdlayout">
<asp:Label ID="Localize1" runat="server">
<%= Placeholder %>
</asp:Label>
</td>
</tr>
</table>
</EmptyDataTemplate>
<Columns>
<asp:BoundField DataField="AtchmtId" HeaderText="Attachment ID"
visible = "false" meta:resourcekey="BoundFieldResource1">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField ="FileNm" HeaderText="File Name" />
<asp:BoundField DataField="UsrNm" HeaderText="Uploaded By"
/>
<asp:BoundField DataField="AtchmtDt" HeaderText="Date"
/>
<asp:BoundField DataField="FileSizeCnt" HeaderText="File Size"
/>
<asp:TemplateField AccessibleHeaderText="Actions" HeaderText="Actions">
<ItemTemplate>
<div style="text-align:center;">
<asp:LinkButton ID="btnDelete" Visible="False" runat="server"
ToolTip="Delete Selected Attachment"
OnClick="btnDelete_Click"
Text="Delete" CausesValidation="True" DisableOnSubmit="True" Group=""
meta:resourcekey="btnDeleteResource1" />
<asp:Label ID="lblPipe" runat="server" Text="|" />
<asp:LinkButton ID="btnView" Visible="False" runat="server"
ToolTip="View Selected Attachment"
OnClick="btnView_Click"
Text="View" CausesValidation="True" DisableOnSubmit="True" Group=""
meta:resourcekey="btnViewResource1" />
</div>
</ItemTemplate>
<ItemStyle Wrap="false" />
</asp:TemplateField>
</Columns>
<%--<PagerSettings FirstPageText="First" LastPageText="Last" NextPageText="Next >" PreviousPageText="< Previous"></PagerSettings>--%>
<RowStyle CssClass="row_odd" />
<AlternatingRowStyle CssClass="row_even" />
</asp:GridView>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
FYI: The GridView is getting the new attachment put in it. I'm just not seeing it on the page because the UploadControl only updates itself.
Edit:Figured it out just used the OnClick() method as below. Derp. Forgot that the ASPx button inherited all the ASP buttons methods. But now my original plan of making the button invisible seems to be foiled. When Button1.OnClick() is called with the Visible property for the Button set to "false". it says Button1 is not defined. Anyway around this?
<ClientSideEvents FileUploadComplete="function(s, e) { Button1.OnClick(); }" />
If I got you right, you can manipulate the behavior of all update panels on page via property called a updateMode (Conditional, Always). Changing one updatepanel will cause refreshing of all, if all have mode set to Always.
How can I conditionally put an image into a cell on my ASPxGridView. For example; if Column1 is above 1000 I would like to see 'above.png' on Column2, if below 1000 i want to see 'below.png' on Column2.
Here is the markup for my ASPXGridView:
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="pkCalisan" Width="100%" >
<Columns>
<dx:GridViewDataTextColumn
FieldName="ID"
ReadOnly="True"
VisibleIndex="0">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Price" VisibleIndex="1"></dx:GridViewDataTextColumn>
<dx:GridViewDataImageColumn VisibleIndex="2"></dx:GridViewDataImageColumn>
</Columns>
</dx:ASPxGridView>
Thanks..
Define a custom image control inside the column's DataItemTemplate and manage the image's properties (visibility or image URL) at runtime.
See the E2270 Example that illustrates how to manage the hyperlink's properties in a similar scenario.
In my aspx page I have a RadPageView which contains RadWindow and the RadGrid is inside the RadWindow. (ie. RadMultiPage -> RadPageView -> RadWindow -> RadGrid).
<telerik:RadWindow EnableShadow="true" ShowContentDuringLoad="false" runat="server"
ReloadOnShow="true" Title="Standard Text: Add Observation." OpenerElementID="lnkObservationsText"
Behaviors="None" VisibleStatusbar="false" EnableViewState="true" ID="rdWndObservationText"
Skin="Web20" Modal="true" Width="600">
<ContentTemplate>
<div class="RadModalMainDiv">
<div>
<p>
Help text to go here....</p>
</div>
<div class="divStandardTextButtonList">
<asp:Button ID="btnObservationsTextSelect" runat="server" Text="Select" CssClass="btnStandardText"
OnClientClick="return ObservationStandardText_Confirm()" />
<asp:Button ID="btnObservationsTextCancel" runat="server" Text="Cancel" CssClass="btnStandardText" />
</div>
<asp:Panel ID="pnl1" runat="server">
<div>
<telerik:RadGrid ID="radGdObservationsText" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" GridLines="None" PageSize="10" Width="100%">
<MasterTableView CommandItemDisplay="None" Name="ParentGrid">
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
</telerik:GridClientSelectColumn>
<telerik:GridBoundColumn DataField="description" HeaderText="Observation Description"
Visible="true">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric" />
<ClientSettings>
<Selecting AllowRowSelect="True" />
<ClientEvents OnRowSelected="SetObservationStandardText" />
</ClientSettings>
</telerik:RadGrid>
</div>
</asp:Panel>
</div>
</ContentTemplate>
</telerik:RadWindow>
When I try to sort the grid clicking on the header, the page refreshes and the RadWindow disappears. Sorting happens coz when i reopens the RadGrid the rows appea sorted. I need the RadGrid to be sroted and remain in the same state.
Thanks for all helps in prior.
You have to reopen the RadWindow manually in order for this to work. I can suggest that you try an easier approach. Remove the OpenerElementID and modify the button that open the RadWindow and the other one that closes it as shown below:
Click handler for the button that open/close the window:
void lnkObservationsText_Click(object sender, EventArgs e)
{
rdWndObservationText.VisibleOnPageLoad = !rdWndObservationText.VisibleOnPageLoad;
}
Click handler code for the close button that resides in the RadWindow itself
void btnObservationsTextCancel_Click(object sender, EventArgs e)
{
rdWndObservationText.VisibleOnPageLoad = false;
}
In this case you won't need to use ReloadOnShow.
Hope this helps. Good luck :)
I'm using a DevExpress grid and I'm trying to get a 'Country' column to display the header filter properly:
<dx:GridViewDataColumn Caption="Country" FieldName="CountryName"
ShowInCustomizationForm="True" Visible="false">
<Settings AllowHeaderFilter="True"/>
</dx:GridViewDataColumn>
If the 'Country' column is set to Visible='true', then the header filter is displayed as it should(it shows the value option list). However, I want the 'Country' column to be initially hidden, but available in a Customization window(like in the code above). In this case, when the column is dragged outside the Customization window and into the grid and the header filter is clicked, a Javascript error is encountered:
element is null
element.addEventListener(eventName, func, true);
Is this a known bug? Are there any workarounds?
Set the ASPxGridView.Settings.ShowHeaderFilterButton property to true to resolve this problem.
The following markup works fine for me (I am using DXperience 10.1.7):
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT * FROM [Categories]"></asp:AccessDataSource>
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" ClientInstanceName="grid"
DataSourceID="AccessDataSource1" KeyFieldName="CategoryID">
<SettingsCustomizationWindow Enabled="True" />
<Columns>
<dx:GridViewDataTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
<EditFormSettings Visible="False"/>
<Settings AllowHeaderFilter="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CategoryName" Visible="False" VisibleIndex="1">
<Settings AllowHeaderFilter="True" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="2">
<Settings AllowHeaderFilter="False" />
</dx:GridViewDataTextColumn>
</Columns>
<Settings ShowHeaderFilterButton="True" />
</dx:ASPxGridView>