PDA

View Full Version : [CLOSED] Razor Syntax for ListConfig on a combobox



machinableed
Mar 13, 2012, 5:39 AM
How can I do the following in Razor syntax?


<ListConfig LoadingText="Searching...">
<ItemTpl runat="server">
<Html>
<div class="search-item">
<h3><span>${Price}</span>{Common}</h3>
{Botanical}
</div>
</Html>
</ItemTpl>
</ListConfig>

Daniil
Mar 13, 2012, 11:21 AM
Hi,

Here you are.

Example

@(Html.X().ComboBox()
.ListConfig(Html.X().BoundList()
.LoadingText("Searching...")
.ItemTpl(Html.X().XTemplate()
.Html("<div class=\"search-item\"><h3><span>${Price}</span>{Common}</h3>{Botanical}</div>")
)
)
)

geoffrey.mcgill
Mar 13, 2012, 3:46 PM
Maybe there is a way we can clean this API up a bit. Having to use a BoundList is not too obvious.

I guess I would have expected the ListConfig properties directly off the ListConfig Builder.

machinableed
Mar 14, 2012, 1:25 AM
Yes Geoffrey - that is what I expected also... I think that would be more consistent with the other methods (especially when compared with the non-razor syntax/structure).

machinableed
Mar 14, 2012, 4:34 AM
Is it possible to do something similar to the example http://examples2.ext.net/#/Form/ComboBox/Custom_Search/ in MVC/Razor syntax? Rather than using the .ashx file, I'm hoping that it's possible to simply use an AjaxProxy pointing to the relevant controller method but I'm not having much luck - i.e. it's never getting triggered...

Daniil
Mar 14, 2012, 8:33 AM
Is it possible to do something similar to the example http://examples2.ext.net/#/Form/ComboBox/Custom_Search/ in MVC/Razor syntax? Rather than using the .ashx file, I'm hoping that it's possible to simply use an AjaxProxy pointing to the relevant controller method but I'm not having much luck - i.e. it's never getting triggered...

Please start a new forum with a sample to reproduce.

Daniil
Mar 27, 2012, 3:31 PM
Yes Geoffrey - that is what I expected also... I think that would be more consistent with the other methods (especially when compared with the non-razor syntax/structure).

Well, we can't see any options to improve it.

Generally, it's the same as here:

.ItemTpl(Html.X().XTemplate()
.Html("<div class=\"search-item\"><h3><span>${Price}</span>{Common}</h3>{Botanical}</div>")
)

If you wish you could set up ListConfig this way:

.ListConfig(new BoundList() { ... })