PDA

View Full Version : [CLOSED] Mix Standard MVC HTML Components With Ext.net



matrixwebtech
May 01, 2015, 6:41 PM
Hi
please guide me how do I put standard MVC Html Component In Ext.Net,I try bellow but not working,


X.Panel()
.Content
(
Html.TextAreaFor(model => model.ArticalDetails, new { @class = "smallinput", @id = "wysiwyg", @name = "wysiwyg", @style = "height: 800px; width: 100%;" })@*,@id="wysiwyg"*@
)

I am trying to place a mce editor inside panel.

Daniil
May 04, 2015, 9:32 PM
Hi @matrixwebtech.

Please use:

@(X.Panel()
.Content(
@<text>
@Html.TextAreaFor(...)
</text>)
)

matrixwebtech
May 05, 2015, 4:06 AM
Thanks for reply ,I do Bellow code one with normal text area and another with Html.Textarea but 2nd one not editable ,can you please investigate?


<!DOCTYPE html>
@*@model e.Controllers.tinymcecontent*@
@{
var X=Html.X();
}
<html>
<head><!-- CDN hosted by Cachefly -->
<script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
<script>tinymce.init({ selector: 'textarea' });</script>
</head>
<body>
@X.ResourceManager()
<textarea>Easy! You should check out MoxieManager!</textarea>
@(X.Panel().Border(false)
.Content(
@<text>
@Html.TextArea("tc")
</text>)
)
</body>
</html>

I just want to know
when ever I need a non EXT.net component(other standard MVC components) in ext.net should I follow this technique?

geoffrey.mcgill
May 05, 2015, 6:47 AM
The issue is probably caused because you are calling tinymce.init before the Panel is rendered. The fix should be just calling tinymce.init after the Panel is Rendered, for example from within the Panel's AfterRender Listener.

Hope this helps.

matrixwebtech
May 08, 2015, 5:06 AM
Hi
I try bellow


<!DOCTYPE html>
@model e.Controllers.tinymcecontent
@{
var X=Html.X();
}
<html>
<head><!-- CDN hosted by Cachefly -->
<script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
<script></script>
</head>
<body>
@X.ResourceManager()

@(X.Panel().Border(false)
.Listeners(l=>{
l.AfterRender.Handler = "tinymce.init({ selector: 'textarea' });";
})
.Content(
@<text>
@Html.TextAreaFor(obj=>obj.content)
</text>)
.Buttons(X.Button().Text("Click")
.DirectClickAction("test")
)
)
</body>
</html>


public class tinymceController : Controller
{
//
// GET: /tinymce/

public ActionResult Index()
{
return View();
}
public void test(tinymcecontent _tinymcecontent)
{

}

}

public class tinymcecontent
{
public string content { get; set; }
}

but editor's value not posted to controller , content property of tinymcecontent class is null in test method .

Daniil
May 08, 2015, 7:27 PM
Is anything being submitted with a DirectEvent? I would expect there is nothing.

geoffrey.mcgill
May 08, 2015, 7:33 PM
Likely because there is no <form>.

geoffrey.mcgill
May 08, 2015, 7:34 PM
Try changing X.Panel() to X.FormPanel(), or wrapping the Panel in a <form>.