Gridview and select

C

cs_in_va

I have an application that has 3 tables, vendors, supplies and
vendor_supplies (this table identified what supplies the vendors
supply)

I trying to build a form with the gridview and a detail view, that
works fine when I select "select" on the gridview the information is
passed to the details view. I also have a checkboxlist that displays
all the supplies from the supplies table. Now I need to somehow link
these, so when I edit the vendor I can select the items they supply.

I'm lost on where to go from here. Should I scrap the detailview and
do with individual text boxes with a single update button to control
both the updating of the vendor data and the updating of the
vendor_supplies?

How do I bind the text boxes to the table adapter I created for the
detailview?
 
A

Angel

I am not clear one hundred percent on what you're attempting.

To bind a detailsview control to a table adapter or datatable do the following

detailsview1.datasource = dt
detailsview1.databind

You can define fields for the detailsview programmatically

dim bf as new BoundField
bf.DataField = "ProductName"
bf.HeaderText = "Product "
DetailsView1.Fields.add(bf)

You can also create templates field programmatically

Dim t as new TemplateField
t.HeaderText = "Supplier"
t.ItemTemplate = New DetailsviewTDDSupps(ListItemType.Item)
t.EditItemTemplate = New DetailsViewTDDSupps(ListItemType.EditItem)
DetailsView1.Fields.Add(t)

This gets really hairy because the reference to that weird name object is a
Template class that you must implement in order to define placement of
controls on the detailsview programmatically. There is references to the on
the MSDN library but unfortunately not easy to find and when you do I think
it refers to a formview control example but the principle is the same. I
wrote an article for my user group entitled “Why is everything so darned
declarative†in which I gripe to no end about this.

If you’re under the gun or unsure about generating all this code then you
might be better off making your own user control and be done with it. But,
if for some reason, you want to pursue this path let me know I will make my
ranting on the subject available to you.

Perhaps I did not answer your question. If that’s the case I urge you to be
more specific and provide a code sample.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top