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.

Parents
No Data
Reply
  • 170
    posted

    Hi Everyone

    Still hoping for some help, I've tried a few things, like creating a server control, which inherits 'Infragistics.Web.UI.ListControls.WebDropDown'. This works well but I still have the problem of generating the 'Template' section of the DropDownItem, programmatically.

    Can anyone from the 'Infragistics team' tell me if it is possible to generate this section programatically? Just a simple yes or no will do.

    In my server control I can now fully control the generation of the control itself (mybase.RenderContents(writer)). And in this RenderContents sub, I can create and add each DropDownItem and add them to mybase.items collection.

    Any help very much appreciated.

    Regards

    PenPal1999.

Children