Question

I'm using the Obout.com MVC controls and have included the following code in one of my views:

@{
   Html.Obout(new ComboBox("Languages") {
       Width = 175,
       SelectedIndex = (int) ViewData["DefaultLanguage"] - 1,
       ShowSelectedImage = true
       }
   );
}

I'm doing it that way because my original attempt failed:

@Html.Obout(new ComboBox("Languages") { Width = 175, SelectedIndex = (int) ViewData["DefaultLanguage"] - 1, ShowSelectedImage = true })

...it seems I need to use the @{} structure. However, when the output gets generated, the code that Html.Obout() generates comes ahead of all other output. the <!DOCTYPE html> and the real page follows the control's output. is this a function of the @{} structure, or is it some issue with the control itself?

Was it helpful?

Solution

It looks like this method was designed for ASPX views and writes directly to HttpContextBase.Response.OutputStream.

Since Razor buffers its output in WebPageBase.Output, you will not easily be able to use these helpers in Razor.
You could put them in a separate ASCX partial view, and they will work.

Depending on how the helpers are implemented, you may be able to force them to write to WebPageBase.Output; since I don't use Obout, I don't know.

OTHER TIPS

The Razor compatible version of the Obout MVC ComboBox will be available soon: http://forum.obout.com/yaf_postsm2112_Examples-pleease.aspx#post2112

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top