Last post Sep 29, 2010 08:56 PM by davidebb
Sep 25, 2010 11:23 PM|zzdfc|LINK
How to use method:public
string GetActionPath(string action,Object row)?
what is data struct of Object row ? Should I do how to new the row? Who can give me a example?
How to use GetActionPath to get url of child list ,please?
Sep 26, 2010 06:11 AM|sjnaughton|LINK
Hi zzdfc, thiis is a method on MetaTable and you use it when you have access to the current entity i.e. in a FieldTemplate in the OnDataBinding event you have the Row object and in the Details page you would also have the DetailsViews OnDataBinding event
and then you cdould use the DataItem from the DetailsView, you could also use this in the SelectedIndexChanging event on the GridView and get it's GridView1.SelectedRow.DataItem. Or you can get access to it via the pages GetDataItem().
You will also see this in the List pages Edit HyperLink
NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'
Sep 26, 2010 09:44 AM|zzdfc|LINK
I have already get url of child list through MetaChildrenColumn.GetChildrenListPath(obj),but it done only the relation is one to many.
if the relation is many to many,How to get url of child list through MetaChildrenColumn?
Sep 26, 2010 10:46 AM|sjnaughton|LINK
Good question I think you would need to write you own method to get that, but I'm not sure wether that is covered as it's many to many i.e. there are multiple entities at the other end [:(]
Not sure what you are trying to achive with thyis though [:(]
Sep 26, 2010 08:31 PM|zzdfc|LINK
I am trying to achive custom list page that don't use GridView.
How to write my method to get that of many to many,please? thanks.
Sep 27, 2010 05:08 PM|sjnaughton|LINK
Hi zzdfc, what are you planning to show on this list page both sides of the M:M, I'm not sure what you want...
Sep 27, 2010 05:40 PM|klca|LINK
Would you mind presenting a sketch diagram (hand made, very rough if you want) of what you expect to accomplish.
Excuse me but I don't get a minimum clue of what you really want.
Carlos Porras (El Salvador)
Sep 27, 2010 08:29 PM|zzdfc|LINK
I am planning to show a link for another side of the M:M on list page , I need get url of the link.
But MetaChildrenColumn.GetChildrenListPath(obj) is valid only when the relation is one to many,
I need the MetaChildrenColumn.GetChildrenListPath(obj) for M:M,How to do ,please?
Sep 27, 2010 10:50 PM|klca|LINK
How many times are you planning to do this?
Have you considered the possibility of "hard coding" the link if it were going to be just once or a couple of times?
What might be the purpose of showing a link if it wasn't that both tables are related between them? If they are related by means of FKs (referential integrity) Dynamic Data shows the links automatically for you, no?
Carlos Porras (El Salvador)
Sep 28, 2010 05:16 AM|zzdfc|LINK
I hope popup a grid window through clicking the link , I have already complished this function to MetaChildrenColunm of 1:M,but it show error to MetaChildrenColunm of M:M
Sep 28, 2010 09:07 AM|klca|LINK
You don't really provide much information but it seems that if your database design where ok then you'd have proper linking between tables but if it were the case that there is a flaw in your design then there is nothin Dynamic Data can do as to solve a
mismatch in a query.
Have you debugged and seen what is going on behind the scenes?
Proper configuration of DataSources should do the trick if they were ok.
How can be solved a situation in which the query m:m (called them m1 and m2) m2 returns rows belonging to m1 (WHAT I MEANT TO SAY IS THAT IF A SUBQUERY WHICH IS SUPPOSED TO RETURN ONLY A SPECIFIC NUMBER OF ROWS WHICH ALREADY HAVE A PARENT IN M1 THEN
IT WILL BE OK BUT IF THE QUERY RETURNS ORPHAN ROWS [IN M2 BUT NOT IN M1] THEN AN EXCEPTION WILL ARISE)
It will rise an exception event of course. So you must filter first the second DataSource as to have included in it the results from the firts one.
That's what I guess
Sep 28, 2010 05:46 PM|davidebb|LINK
It's hard to know for sure without more information about your schema. Can you explain what you are trying to do using a concrete example? I assume you are using EF and not Linq To Sql? That makes a big different with m:m relationships.
e.g. can you take the Northwind Employees/Territories relationship (m:m) and describe in words the kind of page you are trying to go from and go to?
Sep 29, 2010 09:42 AM|zzdfc|LINK
Employees list page have many columns in the grid, one of these columns is Territories column(MetaChildrenColumn type) that displayed as a html link,
when I click the link,it will popup window to show current row employee's all territories.
How to achive this?
Sep 29, 2010 02:48 PM|davidebb|LINK
Note that if you are using 4.0, we improved the Many to Many support (in 3.5SP1, you can get the same thing using the template I
blogged). So when you go to an employee details, you actually see the list of Territories for the employee directly in there. If you look at FieldTemplates\ManyToMany.ascx.cs, you can see how this is done (note that it is EF specific). If you want the
list of Territories to show up somewhere else, you should be able to use similar logic.
Sep 29, 2010 08:52 PM|zzdfc|LINK
but I used esql to solve it ,
"select value o from Territories as o where exists(select value e from o.Employees as e where e.EmployeeID='7')"
It is convenient and easy to use esql,Can you have better ESql to recommend me?
Sep 29, 2010 08:56 PM|davidebb|LINK
I'm no esql expert, but that certainly looks like a reasonable way of listing territories that incluse a specific employee.