Rich Text Area in MVC3 - asp.net-mvc-3

Do we have any Rich Textbox/Textarea options in MVC3 or do we need to use jquery RichTextbox plugins?

ASP.NET MVC has nothing to do with Rich TextArea. You will need JavaScript/jQuery for it. I would recommend using jHtmlArea

You need to use plugins. ASP.NET MVC is a server side framework which allow you to spit HTML. And in HTML you have the <textarea> tag. That's where the ASP.NET MVC framework role ends. If you want to make something more out of this textarea tag you need client scripting => so go ahead and pick your favorite WYSIWYG editor. There are lots of them.

Related

How to set popupCollision configuration property of Kendo Menu using Asp.Net Mvc HtmlHelper?

The example for Kendo Menu documentation here sets the popupCollision property in Javascript. How can this property be set using Asp.Net MVC HtmlHelpers for Kendo Menu?
According to Menu Builder ASP.NET MVC documentation there is not such property. Unfortunately this differeneces sometimes happens betveen JS and ASP versions like there are two other teams of developers.
MVC HTML Helper just generate JavaScript code, so you can try set it using JavaScript setOptions on document ready:
$("#menu").data('kendoMenu').setOptions({
popupCollision: false
});
Or even better, use the javascript version in the first place if you need this property.

using client side validation with telerik controls

Can you use client side validation with telerik controls? The examples show validation using standard html input controls. I have forms with RadTextBoxes, RadComboboxes etc and would like to add validation.
You can access the Telerik client-side api by using
var ctrl = $find('<%= txtSomeTextBox.ClientID %>');
then you can get the current value of the textbox by calling the .get_value() function. Use your browser's debug tool to see which methods are available in the object that is returned or consult Telerik's help site.
Go to Telerik's online demos: http://demos.telerik.com/aspnet-ajax/input/examples/common/validation/defaultcs.aspx and you will find examples for almost anything. This one shows how to use the built-in client-side validation with the RadControls for ASP.NET AJAX.

How to handle asp buttons in mvc

I am using HTML buttons in MVC, but is there any way to handle ASP buttons in MVC rather than HTML buttons?
No, buttons in MVC are pure html code. There is no "OnClick" event like in asp.net webforms.
There is a possibility to use asp.net webforms component in MVC (you can find some blog post if you search), but I discourage this. Stick with HTML

Events in ASP.Net MVC

I read that there aren't events in ASP.Net MVC.
However, I added button and when I double click it a buttonClick event was made.
So, are there events in Asp.Net MVC or not?
That is because you are using the webforms view engine. This view engine includes all the page life cycle stuff from the webforms framework. That means that you can, theoretically, use anything from webforms in asp.net mvc if you are using the webforms view engine. However, I'd strongly suggest that you don't do that. You will miss out on all the advantages with asp.net mvc and you'd be better of just using webforms in the first place.
If you are new to asp.net mvc I'd suggest that you'd use another viewengine instead as that will help you learn the framework a lot better and faster. There is a viewengine from Microsoft called Razor that you could start with.
If you're seeing a buttonClick event handler created when you double-click a button, you are likely attempting to use the Button server control. Instead you should simply include an <input type="submit" value="Button Text" /> element within a <form>. The form's action will result in the controller's action method being called on the subsequent post request.
I highly suggest that you do some do some research on ASP.NET MVC. There are several good resources, but here's a short introductory video to start with:
http://www.asp.net/mvc/videos/mvc-2/how-do-i/5-minute-introduction-to-aspnet-mvc
There are not server control events like there are in webforms. There are jQuery and javascript events that can happen in the HTML/DOM though.
If you double clicked a button on a designer canvas in visual studio, and it created a button click method in another file with a signature like public void MyEvent(EventArgs e), then you are not working with an MVC project.

MyUpdatePanel.Update() in Razor

I am trying to convert my existing ASP.NET application to MVC 3 Razor. I use a lot of updatepanels, and I do conditional updates at the code behind using MyUpdatePanel.Update().
I am not finding this functionality with MVC 3. I can see a lot of blogposts talking about jQuery and how to use it to achieve the same, but I want to render other partialviews from my action conditionally. Is it possible to achieve it?
The way you'd work with Ajax in ASP.NET MVC is completely different from the ASP.NET way (i.e., Ajax toolkit with server-side controls such as UpdatePanel).
ASP.NET MVC is more basic and therefore more work. You handle Ajax calls on the client side using a library such as jQuery, and on the server side you implement a controller with Ajax methods.
Have a look at http://sweettam.blogspot.com/2011/06/aspnet-mvc-3-ajax-part-i.html.

Resources