Recommend html element theme engine for ASP.NET? - asp.net

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.

Related

Display Sitecore MVC rendering inside a Sitecore sublayout (Webforms page)

I've converted a sublayout to a MVC rendering and it needs to be statically bound to another sublayout.
The old sublayout was bound using
<sc:Sublayout runat="server" ID="myID" Path="file/path/tothe.ascx" />
Now that the component is a rendering i've tried
<sc:Rendering runat="server" ID ="renderingID" Path="file/Path/ToView.cshtml"/>
and
<sc:Rendering runat="server" ID="renderingID2" renderingname="ReturnToSearchLink"/>
Neither have been succesful. Just nothing shows up and the rendering doesn't get hit while debugging. Any suggestions would be much appreciated
Out of the Box each page should be either WebForms or MVC.
Not advisable but if you really want there are solutions. Like the Hedgehog MVC aspx interop. I never tried statically bound, but you can give it a try.
See http://www.hhogdev.com/blog/2012/december/mvc-webforms.aspx
See Does anybody have experience in maintaining Sitecore MVC and Web Forms in a single solution?
It's not possible. You cannot have MVC rendering inside WebForms sublayout. MVC and WebForms are different technologies.
What you can do in Sitecore is a site which contains both MVC pages and WebForms pages, but you cannot mix them on a single page.
It's far from the most elegant solution but one option could be to use iframe's to embed the content between the different technologies.
If for example you have a webforms form you want in an mvc site, you setup a webforms page with just the form on and no margin or padding. On your mvc site you then use standard html iframe's to pull things in.
One challenge with this approach is getting the sizes of the iframes correct.
It definitely wouldn't be my first port of call in terms of solutions. However we've used in certain scenarios and it's saved us having to rebuild parts of the site in both technologies.

Conversion from Coldfusion to Asp.net (Drag and Drop Functionality)

I have Coldfusion web application that has a CF query from a database table. This data is displayed in an HTML table with a checkbox beside each data item and an associated picture. There is Jquery functionality on the page so that the items can be re-arranged in the table based on the users preference. After the user finishes with their re-arrangement, it is re-displayed without the checkboxes for sending as an email. Note I did not write this application myself but inherited it...
I need to transfer this functionality to a asp.net C# web application but i am at a crossroads on how to proceed. I've looked at telerik controls and others but none appear to fit the functionality i need. Any solid suggestions?
I'd suggest to handle rendering of the table yourself. If you're using asp.net webforms, this can be done with a custom server control. If you're using asp.net mvc (which I suggest as MVC matches the coldfusion development model a bit closer than webforms), then it's much simpler and you can just do so in the view.
Once you are rendering the grid yourself, then it's simple to apply the jquery functionality on the client-side.
Without more info about what you can or can't do, it's a bit difficult to offer any more guidance. But you did only ask for suggestions :-)
Asp.net doesn't mean you need to use a library control built for .net. jQuery is powerful enough today, and it's not tied to any back end technology.
So, that being said, I would still go with jQuery and back it up with RESTful request using webservices with WebForms or controllers with MVC.
Have a look at this: JQuery Drag and Drop features with ASP.NET

MVC Custom Control?

I am trying to figure out how to use/create a custom control in ASP.NET MVC 2.
I created a custom control earlier and compiled it (ccontrol.dll), the control renders a div, textbox and a button + some javascript in order to post a comment on the website. It could be a static aspx page that i wanted to allow my visitors to add a comment to. I would then drag my control from the toolbar to the aspx page and run it, it would then render all the code needed on the webpage including fetching the data from a datasource and displaying that inside the div. The user could also just type in a comment and press the button to save it to the datasource.
Is this possible to convert to MVC 2? Any good tutorial that covers custom controls and MVC 2? (Ideally would be if the control could be made into a .dll file that i then could reuse on future webpages)
How do i write a custom control the mvc way? Any good tutorials on the topic?
You cannot design Custom Controls according the normal asp.net style because in Mvc there is no ViewState and there are no server side control events. Data are returned back to the server through a Model Binding process. The fact that rendering and filling data in are handled in separated pieces of code make difficult to implement complex server controls in Mvc.
However, I developed a theory, and also a toolset to make quite easily custom controls ina Mvc too in the full spirit of the Mvc paradigm i.e keeping separation of concerns between Views and Controllers. See My Codeplex project. There, you will find pointers to documentation and tutorials on my blog. If you need assistance feel free to contact me.
No it is not possible to use custom controls in ASP.NET MVC. you need to re-write in MVC way

Best way to handle common HTML Controls on ASP.NET

I was wondering, whats the best way to handle common HTML controls in ASP.NET? I mean, ASP.NET server controls generate too much crap inside the code so I rather use common controls.
But how about databind and how to manage those common objects correctly (such as combobox, textbox and so on)?
Don't forget that you can always set runat="server" on any control - that includes standard html form controls such as <input> and <select>, and also other elements like <div>. Anything, really.
This means that you can regain control of the html output in your WebForms pages quite effortlessly - as long as you don't need viewstate or any other more advanced databinding/state managing that ASP.NET normally handles for you.
That said, learning to use the ASP.NET MVC Framework is not a bad idea, since it helps you regain control of much more than just the html output. Generally, creating a page in ASP.NET MVC takes a little more work, since there are no drag-n-drop controls like gridview, textbox or even repeater. Instead, you use html helper methods and regular foreach loops, which means you have to type a lot more code. However, the MVC framework is designed so that you won't have to repeat much code anyway.
If you're concerned about the html markup generated by the WebForms ASP.NET engine, i suggest you take a look at ASP.NET MVC. It's purpose is specifically to give you the control you need over the generated html.
If you don't want to start learning ASP.NET MVC, ASP.NET 4.0 WebForms gives you more flexibility in the generated HTML (such as enabling the ViewState for a specific control only, setting the html id's etc.).
As for the databinding, again if you study MVC in depth and start thinking in terms of action -> result you can gain a lot more control and flexibility.
Later edit: I forgot to mention Razor, the new ViewEngine under development at microsoft. It's currently in beta and only inside WebMatrix, a very stripped down 'getting-started type' development platform for ASP.NET. MVC combined with the very clean code you can write using Razor will be in my opinion an important trend-setter in the web development world.
There's a reason ASP.Net controls generate all that "crap". It's so you can databind and manage those objects correctly. Using standard html controls is useful when you don't need direct databinding or if you have no need to manipulate the control through server-side code.
The best way to handle common HTML controls in ASP.Net is not to handle them directly. By using them to handle data and functionality, you're basically neutering .Net. You might as well go back to classic ASP.

Confused with asp.net controls and html controls

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)

Resources