DetailsView programmatically Add Custom Control

P

Peter Pan

Hi,
i am facing a problem adding a custom Control to the Detailsview in
codebehind.

When i add Data via a Datatable like:
DetailsView1.DataSource = GetMetaDataByID("220");
DetailsView1.DataBind();

the data is shown (lets imagine the datatable has 2 columns ID and Products
and only returns a single row).
Now i want to Edit the Products Values with my custom MultiComboBoxControl.
How can i bind the control programmatically to that column?

If i add it as follows:
MultiComboBoxControl ctrl = new MultiComboBoxControl();
ctrl.GetDataStoredProcName = "sp_GetAllFaechers";
ctrl.SetDataStoredProcName = "_SiT_Update_Doks_Y_Fach";
ctrl.HeaderText = "Multi-Combo1";
ctrl.DataField = "Anzeige_Faecher";
ctrl.ReadOnly = false;

DetailsView1.Fields.Add(ctrl);
The Data is shown additional, i mean the detailsview than shows One ID row
and 2 Products rows, where one is editable with my MultiComboBoxControl, like
i wanted.
But i want to bind it to the other products field.
And if i only add the field to the DetailsView without setting the
datasource nothing is displayed.
I think i have to bind my custom Control to the Data from the datatable but
i don t know how.

thansk for help.
Greets
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top