Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
Programmatically create template with child items.
posted

Programmatically create template with child items.

 

Hi Everyone

 

I’m trying to create a template layout for the ‘WebDropDown’, programmatically. Does anyone know if this can be done?

 

I populate my ‘WebDropDown’ controls using a generic subroutine like this.

 

  For Each objMLPD_WorksTempEmp_Item In objMLPD_WorksTempEmp_IList

    objIListItem = New Infragistics.Web.UI.ListControls.DropDownItem()

    objIListItem.Text = objMLPD_WorksTempEmp_Item.Surname _

      & " " & objMLPD_WorksTempEmp_Item.FirstName & " " _

      & "[" & objMLPD_WorksTempEmp_Item.ClockNumber & "]"

    objIListItem.Value = objMLPD_WorksTempEmp_Item.SQLWorkTeamList

    icboFindGangClockNumber.Items.Add(objIListItem)

  Next

 

This works well, but the rows look a bit unformatted. I would like to modify my subroutine so that it will generate a Template block for each ListItem.

 

<ig:WebDropDown ID="icboFindGangClockNumber" runat="server" Width="95%" DropDownAnimationType="EaseOut"

DropDownContainerHeight="300px" DropDownContainerMaxHeight="300px"

DropDownContainerWidth="300px" Height="21px"

StyleSetName="SkanskaStyleSet1" StyleSetPath="~/ig_res/"

MultipleSelectionType="Keyboard">

  <Items>

    <ig:DropDownItem Selected="False" Text="Surname FirstName [abcd1234]" Value="1">

      <Template>

        <div class="WebDropDownHolder">

          <div class="WebDropDownLeft"> Surname </div>

          <div class="WebDropDownRight"> abcd1234 </div>

          <div class="WebDropDownCenter"> FirstName </div>

        </div>

      </Template>

    </ig:DropDownItem>

  </Items>

  <ItemTemplate>

    Item Template

  </ItemTemplate>

</ig:WebDropDown>

 

I have had a good look at the properties of the ‘Infragistics.Web.UI.ListControls.DropDownItem()’. I noticed the objIListItem.Template property, but don’t know how to add my <div> definition to it.

 

 

Any help very much appreciated.

 

Regards

 

PenPal1999.