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
1730
adding Htmlattributes to igCombo
posted

Hi,

I am trying to add a style to igCombo using htmlattributes property as shown below:

@(Html
                            .Infragistics()
                            .Combo().ID("CategoryList")
                            .MultiSelection(ComboMultiSelection.OnWithCheckboxes)
                            .Width("200px")
                            .HtmlAttributes(new System.Collections.Generic.Dictionary<string,object>().Add("class" , (object)"span-text"))

                            .Height("20px")
                            .ValueKey("TagKey")
                            .TextKey("AttributeName")
                            .Mode(ComboMode.DropDown)
                            .SelectedValues(ViewBag.CategoryListSelected)
                            .DataSource(ViewBag.CategoryList)
                            .DataBind()
                            .Render()
                        )

The code is throwing error of invalid arguments. Whats wrong here ??

Parents
No Data
Reply
  • 23953
    Verified Answer
    Offline posted

    Hi,
    Try with this code:

    Code Snippet
    1. @(Html
    2.     .Infragistics()
    3.     .Combo().ID("CategoryList")
    4.     .MultiSelection(ComboMultiSelection.OnWithCheckboxes)
    5.     .Width("200px")
    6.     .HtmlAttributes(new System.Collections.Generic.Dictionary<string, object>() { { "class", "span-text" } })
    7.     .Height("20px")
    8.     .ValueKey("TagKey")
    9.     .TextKey("AttributeName")
    10.     .Mode(ComboMode.DropDown)
    11.     .SelectedValues(ViewBag.CategoryListSelected)
    12.     .DataSource(ViewBag.CategoryList)
    13.     .DataBind()
    14.     .Render()
    15. )

    The only difference between your code and this code is in HtmlAttributes method (line 6).

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc.

Children