I have created a server control in ASP.NET that generates DLL and we can use it an any another application we need. It is so helpful.
Now I want to create server control type of application in PHP and ASP.NET MVC 3. Can you provide me some sample application or example for PHP and ASP.NET MVC 3, so that I am able to achieve my task?
Dai's simple rules for converting from ASP.NET WebForms Controls to Anything Else:
If I have this in WebForms:
public class WhateverControl : Control {
public String SomeParameter { get; set; }
public override void Render(HtmlTextWriter wtr) {
wtr.WriteLine("<p>" + SomeParameter + "</p>");
}
}
In PHP, like this:
class Model {
// control parameters go here, e.g. visiblity, data to be displayed, form fields, etc
public $someParameter;
}
public function renderWhatever(Model $model) {
echo "<p>" . $model->someParameter . "</p>";
}
In ASP.NET MVC (using Helpers), like this:
public class Model {
public String SomeParameter { get; set; }
}
public static MvcHtmlString Whatever(this HtmlHelper html, Model model) {
return MvcHtmlString.Create("<p>" + model.SomeParameter + "</p>");
}
<%= html.Whatever( new Model() { SomeParameter = "arse" } ) %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.