spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Get name of the item instead of parent Id in dataGrid


Assuming, that you're using Group class like this:

public class Group
{
    public int GroupID { get; set; }
    public string GroupName { get; set; }
    public int ParentID { get; set; }
    public Group Parent { get; set; }
}

and that the data source for DataGrid is a collection of Group, the binding expression for the second column should look like this:

<DataGridTemplateColumn
Header="Parent Name">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding
Parent.GroupName}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
   
<DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <TextBox Text="{Binding
Parent.GroupName}" />
        </DataTemplate>
   
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

Note, that you have to use either lazy loading, or explicitly load reference to parent group from query:

context
    .Groups
    .Include(_ => _.Parent)
    .ToList();

Categories : C#

Related to : Get name of the item instead of parent Id in dataGrid
Hover dropdown: clicking parent link goes to parent page
If I understand correctly, this could be the answer add link in the button <div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"> <a href="http://stackoverflow.com">Dropdown parent link</a> <span class="caret"></span> </button> <ul class="dropdown-menu">

Categories : Javascript
parent of parent - how to make it prettier codewise
Do you know the type of selector you need? Why not .closest()? $myDiv.closest('.parentSelector'); Also, you can use div.parent().parent(), will work just as well

Categories : Jquery
What is the best way to create a parent/master entry in a DJANGO CRUD database app and then add associating data fields to the parent/master?
No. You don't need multiple barcode models. The fact that you have a ForeignKey from barcode to hardware already allows you to have multiple barcodes for each hardware: a ForeignKey defines a many-to-one relationship. Also, it doesn't make any sense to name the foreignkey after the model it is in: it needs to be named for the model it is pointing to, ie hardware. Finally, don't prefix your field n

Categories : Python
Having a Parent-Children class hierarchy, how can I hold various actual children in a single "Parent"-typed variable?
If those objects don't need to live very long, then you could simply do: switch(arg[1]) { case CHILD1: { Child1 c1; c1.start(); break; } case CHILD2: { Child2 c2; c2.start(); break; } case CHILD3: { Child3 c3; c3.start(); break; } } On the other hand, if you need to keep

Categories : C++
c# list binding to wpf datagrid
You can't bind to non-public member. Create property public List<ChainCode> ChainCodeList { get { return _chainCode;} set { _chainCode = value;} } and bind to it. If your list will change at app lifetime you can use ObservableCollection<T> instead.

Categories : C#
Recently Add
How to call a method in .cs file which was implemented in code behind?
How To Prevent $variables In Restangular Post Request
Windows Phone 8 VoIP SIP Provider
How do we set the AutoCAD layer viewport override values
Load Dependent DLL using reflection
The code is not showing any error but still not displaying data on the datagrid of webform.?
Make an Image that can be flipped over in Unity 4.6
Storing JSON REST response in object
which is more efficient in conditional looping?
WebBrowser control's shortcut keys are not working
C# SQL INSERT not appearing in database table "no errors or exceptions thrown"
c# winfrom treeview class binding
How to Convert string "00h:03m:30s:793ms" to TimeSpan in c#
Calling a parameterized Stored Procedure that returns a value in C#
How to use the SQL statement to transform the data from row record to column record
How to Instantiate Enemy Prefabs Without Knowing the Name
MVC JQuery unobtrusive validation
How to draw at top left of metaFile
How to make Aggregate Root method only accessible for a Domain Event and nothing else.
how to create a list of lists from one list using LINQ?
Ignore user roles in ASP .Net MVC 5 Identity
Xpath Web scrape
add property to interface
How can I make controls added to existing mark-up be automatically hooked up to the code behind?
Too much data in C# windows form combobox, taking 30 sec to show the windows form
Creating a scrolling grid of images using WPF and XAML
PHP equivalent to asp.net routing
LINQ aggregate query
Custom Control won't fill dock correctly
Get ASP.NET Identity Current User In View
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.