Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Is there an available web control like this? (http://www.velocityreviews.com/forums/t770683-is-there-an-available-web-control-like-this.html)

Erick T 08-07-2003 06:26 PM

Is there an available web control like this?
 
Hello,

I am looking for a Web UI Control, either commercial or free. I don't
know exactly what to call it, so I will describe what I need it to do.
In a nutshell, it's a control to visually represent an intersection
table in a many-to-many relationship. For example, in this ERD

Country ----< CountryVisit >---- Person

each country can have more then one person visiting, and each person
can visit more then one country. What I want to have is a way to
display/edit information for the association/intersection table; all
possible records shown with one end fixed (either all Countries for a
person, or vise versa). The CountryVisit (or intersection) table could
have a number of fields

CountryID
PersonID
DateOfVisit
etc

So the control needs to behave like the DataGrid, where you can define
a template for the items to be displayed. So if my countries were
(USA, Canada, UK) I could fix the Person, and the control would show
(for example) (aircode, but if anything doesn't make sense, let me
know)

<ItemTemplate>
<asp:checkbox checked=<%
IsNull(Container.DataItem("Item.CountryID")) %> Text=<%
Container.DataItem("Item.CountryName") %> />
</ItemTemplate>

and the ItemTemplate would repeat for all possible Countries. Also,
the control would have events for when a row in the intersection table
is created or deleted, so I could set the columns as needed.

The reason I want this control is that a lot of my databases have
large numbers of these intersections tables. And I seem to end up
writing the same code over and over again. What I generally write is
below.

I need a method in my code behind to correctly populate the List,
which is called when the elements of the page are DataBound. e.g.,

<asp:CheckBoxList id="checkBoxList" DataSource = "Country" etc />

and in the codebehind:

CountryVisitView.Filter = "PersonID = " + someID;
foreach (CountryVisitRow r in CountryVisitView) {
list.FindItem(r.CountryID).Checked = true;
// set other properties (date, etc)
}

Then, in my update method, I often end up doing something like this,
which simply syncs the contents of the list to the recordset.

CountryVisitView.Filter = "PersonID = " + someID;
// find newly added rows in intersection
foreach (Item i in checkBoxList) {
if (i.Checked == true) {
// or method which loops over the view
if (!CountryVisitView.Contains(i.CountryID)) {
// add row to CountryVisitView
}
}
if (i.Checked == false) {
if (!CountryVisitView.Contains(i.CountryID)) {
// remove row from country view
}
}
}

What I would like, is something like

<IdealControl
IntersectDataSource="CountryVisit"
Relationship1Name="CountryVisitCountry">
Relationship2Name="CountryVisitPerson"
Fixed="PersonID=123"
OnAdd="AddIntersectRec"
OnRemove="RemoveIntersectRec"
>

<ItemTemplate>
<asp:CheckBox ... > etc
// with DataItem a reference to the current
DataRow/DataRowView of the intersection table
</ItemTemplate>
</IdealControl>

Then, the OnAdd/OnRemove events would work like the ADO.NET
SqlRowUpdating event, where I can inspect/update/cancel the pending
operation (the addition or removal of the row in the Intersection
table). I hope this makes sense, if not, let me know and I'll answer
anything I can.

Sorry about the long post, but I wasn't sure how to describe this.
Does anyone know if such a control exists?

Thanks,
Erick

Tommy 08-08-2003 01:45 AM

Re: Is there an available web control like this?
 
http://www.infragistics.com/products/grids.asp

The above grid has the presentation layer you're looking. Not too sure
about the logic behind it. Hope this helps.

Tommy,

joikm@hotmail.com (Erick T) wrote in message news:<888ecafd.0308071026.429e227a@posting.google. com>...
> Hello,
>
> I am looking for a Web UI Control, either commercial or free. I don't
> know exactly what to call it, so I will describe what I need it to do.
> In a nutshell, it's a control to visually represent an intersection
> table in a many-to-many relationship. For example, in this ERD
>
> Country ----< CountryVisit >---- Person
>
> each country can have more then one person visiting, and each person
> can visit more then one country. What I want to have is a way to
> display/edit information for the association/intersection table; all
> possible records shown with one end fixed (either all Countries for a
> person, or vise versa). The CountryVisit (or intersection) table could
> have a number of fields
>
> CountryID
> PersonID
> DateOfVisit
> etc
>
> So the control needs to behave like the DataGrid, where you can define
> a template for the items to be displayed. So if my countries were
> (USA, Canada, UK) I could fix the Person, and the control would show
> (for example) (aircode, but if anything doesn't make sense, let me
> know)
>
> <ItemTemplate>
> <asp:checkbox checked=<%
> IsNull(Container.DataItem("Item.CountryID")) %> Text=<%
> Container.DataItem("Item.CountryName") %> />
> </ItemTemplate>
>
> and the ItemTemplate would repeat for all possible Countries. Also,
> the control would have events for when a row in the intersection table
> is created or deleted, so I could set the columns as needed.
>
> The reason I want this control is that a lot of my databases have
> large numbers of these intersections tables. And I seem to end up
> writing the same code over and over again. What I generally write is
> below.
>
> I need a method in my code behind to correctly populate the List,
> which is called when the elements of the page are DataBound. e.g.,
>
> <asp:CheckBoxList id="checkBoxList" DataSource = "Country" etc />
>
> and in the codebehind:
>
> CountryVisitView.Filter = "PersonID = " + someID;
> foreach (CountryVisitRow r in CountryVisitView) {
> list.FindItem(r.CountryID).Checked = true;
> // set other properties (date, etc)
> }
>
> Then, in my update method, I often end up doing something like this,
> which simply syncs the contents of the list to the recordset.
>
> CountryVisitView.Filter = "PersonID = " + someID;
> // find newly added rows in intersection
> foreach (Item i in checkBoxList) {
> if (i.Checked == true) {
> // or method which loops over the view
> if (!CountryVisitView.Contains(i.CountryID)) {
> // add row to CountryVisitView
> }
> }
> if (i.Checked == false) {
> if (!CountryVisitView.Contains(i.CountryID)) {
> // remove row from country view
> }
> }
> }
>
> What I would like, is something like
>
> <IdealControl
> IntersectDataSource="CountryVisit"
> Relationship1Name="CountryVisitCountry">
> Relationship2Name="CountryVisitPerson"
> Fixed="PersonID=123"
> OnAdd="AddIntersectRec"
> OnRemove="RemoveIntersectRec"
> >

> <ItemTemplate>
> <asp:CheckBox ... > etc
> // with DataItem a reference to the current
> DataRow/DataRowView of the intersection table
> </ItemTemplate>
> </IdealControl>
>
> Then, the OnAdd/OnRemove events would work like the ADO.NET
> SqlRowUpdating event, where I can inspect/update/cancel the pending
> operation (the addition or removal of the row in the Intersection
> table). I hope this makes sense, if not, let me know and I'll answer
> anything I can.
>
> Sorry about the long post, but I wasn't sure how to describe this.
> Does anyone know if such a control exists?
>
> Thanks,
> Erick



All times are GMT. The time now is 04:59 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.