I am using a DevExpress ASPxGridView containing column GridViewDataComboBoxColumn.
The combo box is working correctly in edit mode (allows AJAX style filtering; it inserts, updates and deletes correctly).
The only problem is that in display mode it is displaying the ValueField (numeric id) instead of the TextField.
<dx:GridViewDataComboBoxColumn Width="200px" FieldName="LocationKeyUid" VisibleIndex="0" Caption="Index">
<PropertiesComboBox EnableCallbackMode="true" CallbackPageSize="7" IncrementalFilteringMode="StartsWith"
OnItemsRequestedByFilterCondition="ItemsRequestedByFilterCondition" OnItemRequestedByValue="ItemsRequestedByValue"
TextField="KeyValue" ValueType="System.Int32" TextFormatString="({0}) {1}" ValueField="LocationKeyUid" />
As shown above, I've tried different experiments with setting the TextFormatString, but that seems to be ignored.
I am binding as follows:
IList<LocationKeyGridViewModel> locationKeys = GetLocationKeys();
locationKeyGridView.DataSource = locationKeys;
locationKeyGridView.DataBind();
The class property names (below) are assigned to the TextField and ValueField property settings (above).
public class LocationKeyGridViewModel
{
public int LocationKeyUid { get; set; }
public string KeyValue { get; set; }
}
I have tried changing the FieldName property assignment to the TextField assignment
(i.e. KeyValue) but that generates an Input string is not in correct format error.
Is there something obvious here that I am missing?
Related
I am selecting multiple lines (ctrl/shift+click) from the grid on the Sales Order screen and want an action to have access to what was selected. How do I access the list of what's selected on the grid from the code behind?
As stated, add the selected screen. First you would add a DAC extension to add the selected field, which is not a DB field.
#region Selected
[PXBool]
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected { get; set; }
public abstract class selected : PX.Data.BQL.BqlBool.Field<selected> { }
#endregion
From there, you can add the selected field to your table in the UI. Also, ensure that commit changes is set on that field, or an action that you may call to query.
Finally, you can just run a foreach for the view, and check for the selected field you added:
foreach (SOLine line in Base.Transactions.Select())
{
SOLineExt lineExt = line.GetExtension<SOLineExt>();
if (line.Selected == true)
{
//execute code on the record
}
}
I have a problem with Xamarin.Forms.EntryCell. I want to know how to trigger an event if the text of the EntryCell has changed. Not the event 'Completed', it is just triggered when I press Enter after inputting anything.
<EntryCell
Label="User Id"
x:Name="UserIdEntryCell"
HorizontalTextAlignment="End"
Completed="UserIdCompleted"/>
Obviously there is no event that is fired when the text is changed (see the docs). Anyway, this does not mean that you can't achieve what you want, by means of Text property. Since you are using the event I do not assume that you use MVVM (you should really give it a try, though), hence we'll have to create a property we will bind the EntryCell.Text to in your view (I'm assuming a view, but for a page it would be quite similar)
In your code behind add a property Text that calls HandleTextChanged from its setter:
class MyView : ContentView
{
string _text;
public string Text
{
get => _text;
set
{
_text = value;
HandleTextChanged();
}
}
private void HandleTextChange()
{
// do whatever you need to do
}
}
You can bind this property to EntryCell.Text from your XAML
Now MyView.Text will be set every time the text in your EntryCell changes.
I am adding a notes field to the grid of AP202000 (Vendor Prices) and when I enter something and hit save, it doesn't stick. I have added the NoteIndicator="True" to the grid on the AP202000 Page and I have added this code to the APVendorPrice DAC, not as an extension:
#region NoteID
public abstract class noteID : PX.Data.IBqlField
{
}
protected Guid? _NoteID;
[PXNote]
public virtual Guid? NoteID
{
get
{
return this._NoteID;
}
set
{
this._NoteID = value;
}
}
#endregion
Here is the code for the grid header:
<px:PXGrid ID="grid" runat="server" DataSourceID="ds" Height="144px" Style="z-index: 100" Width="100%" Caption="Sales Prices"
SkinID="Details" FilterShortCuts="True" NoteIndicator="True" FilesIndicator="True" ActivityIndicator="True" AdjustPageSize="Auto" AllowPaging="True" SyncPosition="true" >
I noticed other forums where it said if I would do these two things then the notes field would work, however this is not my case. This is for the note field to be on the grid with each row and would save to each individual row on the grid, not the notes field at the top.
I've got a very complex form and i'm using the MVC model binding to capture all the information
I've got it set up to capture all the different submissions that can happen as there are about 10 different submit buttons on the form, and there are also 2 image buttons
I tried to get a bit clever (or so i thought) with capturing the image button submissions, and have created a child class so that i can capture the x value that's returned
public class ImageButtonViewData {
public int x { get; set; }
public string Value { get; set; }
}
The parent class looks something like this
public class ViewDataObject {
public ImageButtonViewData ImageButton { get; set; }
public ViewDataObject(){
this.ImageButton = new ImageButton();
}
}
The html for the image button then looks like
<input type="image" id="ViewDataObject_ImageButton" name="ViewDataObject.ImageButton" />
This works fine in all browsers except for Chrome.
When i debug it in chrome, the Request.Form object contains the values that i would expect, but after the model binding has occurred, the ImageButton property on the ViewDataObject has been set to null
The only difference that i can see between the submission values is that Chrome passes the x as lower case (ViewDataObject.ImageButton.x) and IE passes it as upper case (ViewDataObject.ImageButton.X) but i didn't think that model binding took any notice of casing on property names
Does anyone have any ideas ?
EDIT => Just to clarify, i'm not trying to find a workaround for this, i'm trying to figure out why this technique doesn't work in Chrome considering it works in all the other browsers and the correct data is being passed through
There are a couple of options, let me list a view
To check which button was pressed, you could give all the buttons the same names, but different id's. In your FormCollection on your Controller Action, you should be able to get the button that was pressed by doing something like "collection["buttonName"]" and checking it's value.
I think this option is the correct one to go for, and it is as follows. Separate your forms properly. You can have multiple forms on a page and tie each to it's own Controller Action, you don't need to do ugly if statements and it actually separates your actions nicely.
I hope that this answers your question somehow.
I could not reproduce your problem, but I don't think that image inputs return a value, only .x and .y. The following works in Chrome, Firefox and IE (sorry about vb.net):
Public Class ImageButtonViewData
Public Property X As String
Public Property Y As String
Public ReadOnly Property WasClicked As Boolean
Get
Return Not String.IsNullOrEmpty(X)
End Get
End Property
End Class
I have a Dynamic Data website and while inserting a record into a table, the foreign key relationship shown as a drop-down uses the wrong field for it's select item text value.
How can I change the drop-down such that when working with this one table, it will use a different column as the value in the drop-down?
thank you
The solution is to add a partial class with some attributes from the System.ComponentModel.DataAnnotations namespace & assembly. Notice the [DisplayColumn("Description")] below. That's what field is used to render as the text in a list.
Further reading
[MetadataType(typeof(ProductMetadata))]
**[DisplayColumn("Description")]**
[ScaffoldTable(true)]
public partial class Product
{
}
public class ProductMetadata
{
[UIHint("TextReadOnly")]
public string CreatedBy;
[UIHint("TextReadOnly")]
public string CreatedDate;
[ScaffoldColumn(false)]
public EntityCollection<OrderItem> OrderItem;
}