DetailsView programmatically Add Custom Control

Discussion in 'ASP .Net' started by Peter Pan, Apr 13, 2009.

  1. Peter Pan

    Peter Pan Guest

    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
    Peter Pan, Apr 13, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Stafford
    Replies:
    1
    Views:
    8,334
    Mark Stafford
    Aug 29, 2006
  2. Cas
    Replies:
    0
    Views:
    938
  3. Cas
    Replies:
    0
    Views:
    793
  4. Angel
    Replies:
    3
    Views:
    698
    Angel
    Dec 12, 2007
  5. Feege
    Replies:
    0
    Views:
    445
    Feege
    Dec 20, 2005
Loading...

Share This Page