Does ASP.NET MVC4 has anything to do with multi-browser compatibility limitations?
In other words: the ASP.NET MVC engine also generates HTML server side which is displayed client side (right??), does it generate "non multi-browser compatible" HTML markup or do those two things have nothing to do with each other?
ASP.NET MVC framework doesnt generate HTML by itself, it use view engines to create HTML like: RAZOR, ASPX, SPARK and etc.
No , asp.net MVC does not magically generate any html. it render wherever you put in your views.
you will have to write your code to be "multi-browser compatible".
Related
I know that the browser will understand only 3 languages, those are HTML/CSS/Javascript.
I read,
https://learn.microsoft.com/en-us/aspnet/web-pages/overview/getting-started/introducing-razor-syntax-c
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-2.2
Example:
#Html.Action("ActionName", "ControllerName")
#using mvcTestProject.Controller.Models.Example
And above razor syntax is how and who converts razor to HTML?
You are right that a Browser will mostly process the HTML/CSS/Javascript.
Razor syntax never makes it to the Browser. Razor engine parses the syntax and produces html on the server side which goes to the Browser and then the browser renders those as usual.
Razor view engine comes with the Dotnet framework (System.Web.Razor). It is written in C#.
You can read more about the View Engine here: What is view engine? What does it actually do?
I wonder to know if we can add HTML5/Jscript files to ASP.Net MVC2 Project?
If yes , How ?
ASP.NET MVC is a pattern where you have total control over the views. This means that you can write any javascript and HTML markup you like. If you like HTML5, then you can use HTML5.
I am building a site with WebMatrix using the razor syntax in .cshtml files. However I'm stumped as to how I can use the normal set of asp.net controls that are found in the toolbox in Visual Studio - eg: calendar, panel, radio button list etc... Is it possible to use these or can you only use Helpers with razor?
You cannot use ASP.NET controls with razor / .cshtml.
ASP.NET controls work with the ASP.NET WebForms view engine. Razor is a fundamentally different view engine than web forms.
If you really want to use the 'old' controls, switch to .aspx pages. If that's not an option, look into a UI library like jQuery UI. That should give you a similar set of controls.
Note that in razor a lot of controls like radio button list are obsolete. It takes just a few lines of markup to create the same behavior, without the databinding hassle though.
As an alternative tool, you can use Telerik Tabstrip and pass your .csHtml file as a partial view to it.
Some thing Like this:
#{ Html.Telerik().TabStrip()
.Name("TabStrip")
.Items(tabstrip =>
{
tabstrip.Add()
.Text("My First tab")
.Action("Index", "ControllerName")
.ImageUrl("~/Content/Common/Icons/Suites/mvc.png")
.Content(
#Html.Partial("csHtmlName_1", (List<TypeOfYourData>)ViewData["NameOfrelatedView"]).ToString()
);
tabstrip.Add()
.Text("My Second Tab")
.Action("secondAction", "ControllerName")
.ImageUrl("~/Content/Common/Icons/Suites/sl.png")
.Content(#Html.Partial("csHtmlName_2", (List<TypeOfYourDate>)ViewData["NameOfrelatedView"]).ToString()
);
})
.SelectedIndex(0)
.Render();
}
Please note that you need to install MVC Telerik first.(It's free :) and OpenSource)
You can't use Server Controls in ASP.NET Web Pages. It has been designed as an alternative to Web Forms.
You can use plain HTML or you can use the range of HTML helpers which work in a similar way to the ones in MVC (without the ModelBinding).
Is it any theme or css framework can apply to ASP.NET?
I work with ASP.NET webform, everybody known web controls generate pure html to work.
But i am not good at graphic design, so I want to find some UI helper.
I already work with jQuery and Ajax Controll Tookit, but it not much help to make a modern UI design.
I have found some commercial library like ComponentArt,DevExpress etc, but is it any free or opensource I can use?
Web Controls generate pure html. The only "odd" item that is added is the id of the control. In ASP.Net 4.0 you can determine how the ID is generated - including eliminating the id generated by the .Net Framework. You can set this in the web.config with the value
<pages clientIDMode="Static">
Read more about ClientIDMode here.
Now, you can add a CssClass to a control and use that to style, which is the best way to go.
You can search google for "ASP.Net Web Page Templates" or "ASP.Net Web Design Templates", but you are still going to have to handle some CSS yourself.
We are plannning to use Ajax in our ASP.net project. However, we still want the member panel of our web site to work in all browsers. We have decided not to use Ajax in some forms where browser independence is must.
I am now confused with whether we should use ASP.NET controls or HTML controls or both?
I have two questions:
Are there any problems that I might face using either of approach?
Also which one is better considering efficiency and performance?
The Asp.Net Controls including the ajax controls are independent of browsers, asp.net will detect your browser and try to render the best html/javascript for that browser. So you are good with server controls.
If you are going to implement the project in asp.net then for all the controls that need to be accessed via code at server side needs to be asp.net controls. Those controls that are static and only displaying some value can be html controls.
The main point is that the asp.net controls are rendered to html controls... so the client who views the web-page actually gets the html controls.
For AJAX refer this
ASP controls and HTML controls as complementary.
ASP controls bring facilities for programming like the viewstate (the control keeps its content after a post back), the binding with datatable, and a lot of presentation properties. It is really an advantage in terms of time and maintainability to use these controls. They also manage some security feature like html code injection. ASP controls could be controled and managed from the code behind page.
HTML controls are out of the native ASP.NET page process. It is sometime a good thing to have particular control that you don't want ASP.NET take in charge and modify, but it is not the core of an ASP.NET web application.
If you can use HTML - it is always better - as it is much faster.
The use of ASP controls should work on all browsers as far as I know, but it less efficient.
Better create a small example and test it on some browsers before you decide.
(I've used ajax on both explorer and Firefox and it works)