Edit the Html.BeginForm helper method in asp.net - asp.net

I have a specific theme which I apply to my html and now instead of editing it everything I create view. I want to edit the html helper methods and all all my necessary classes and id information can be put in one place.
How do i do this?
Do I just create a new custom one or is it easier to edit one that is already there? I do plan to add some ones that are not there.
I have googled abit but all the answerers I found give specific code to their problem. I dont even know which folder to put my classes in? In a book im reading about mvc it explains custom model template, but i dont think that is exactly what im looking for?
Even a basic example will be great.

Do I just create a new custom one or is it easier to edit one that is
already there? I do plan to add some ones that are not there.
I would say creating a custom one would be fast and simple. But if you still want to give a try by enhancing existing one, than you can get the source code of System.Web.Mvc for CodePlex, and make your necessary modifications and build it, reference it and use it in your project.

Related

IdentityServer3 - CustomViewService Vs DefaultViewService

I would like to change the look and feel of the login page that is served up by IdentityServer3.
Effectively i would like to add a selection of stylesheets (as its used across multiple sites) that can be added. I am also looking to include an additional "Register" button that will take you too another page along with a forgot password link.
I know i can add the forgot password link in the LoginPageLinks list on startup, but the modification for registration i dont think will work this way. (Please correct if im wrong)
I have read the ID3 documentation on modification and it appears i can get most of what i want by modifying the DefaultViewService, however a custom View service (implementing the IViewService) seems to give me everything, but you have to have all of the assets in place explicitly in my solution (js/css/html/less/fonts).
What i want to know is am i missing something here? is the DefaultViewService the answer? and how modifiable is it really? as i dont really want to go down the root of the implementing a custom view.
A 100% custom IViewService is rarely the way to go, as it's a lot of work. You can always implement custom HTML templates to add your CSS and whatever custom markup you want. If you need it to be dynamic, then you can look into deriving from the DefaultViewService and overriding the appropriate methods to add what you need at runtime.

Silverstripe URL Mapping

I'm trying to understand how URL Mapping works. I've gone through numerous pages, but I can't seem to wrap my head around what I'm trying to do.
Its really simple, I use DataObjects as pages approach and I have a member extension written to the member class. And I have the typical actions, show, edit, add.
So if I go to www.mywebsite.com/members/show/1 I can see the first user. If I change show to edit, I can edit the first user. Now if I go to www.mywebsite.com/members/add I can create a new user. This is working all as expected due to the functionality I created in the add method.
My problem is in the fact that when you go any website, you don't register to the website by going to members/add, you register by going to website.com/Register or something similar. From code management perspective, it is a lot easier for me to leave the code the way it is now. I don't want to have to create a Register page and move the code there, instead I am trying to figure out if it is possible to go to www.mywebsite.com/Register and have it load www.mywebsite.com/members/add. I am not talking about a redirect link that would update the url, I want users to still see Register in the url and not see /members/add.
Vice versa, if users were to go to www.mywebsite.com/members/add I want the link to update to Register or say page not found.
Is this possible with Silverstripe Framework?
I am not 100% sure, but I believe this is called URL Masking.
This is very possible, firstly I'd advise that you look over...
silverstripe-memberprofiles
...because even if you dont' want to use an existing module I'm sure there would be useful information. There is a great example of "pure" routing (i.e. silverstripe no cms) that leads on to "nested" routes - which is what I think you are asking for, so I highly recommend reading the slides below and then the created todo app
silverstripe-framework-building-without-the-cms
todo app source

Customizing GraffitiCMS

I downloaded GraffitiCMS the other day(now open source and free), and like a lot of what I see, but what I really want to use it for, is to add CMS capabilities to an existing asp.net database/application.
Without getting bogged down with all the details of my app, can someone give me the basic 'approach' that should be taken to add custom content to Graffiti; content that won't be a 'post'?
I've seen for example, how to add custom-widgets to Graffiti - basically inherit from the widget class, compile your dll and plop it into the correct directory and it becomes part of the system. Is there a way to do something similar for the main content areas?
For simplicity sake, pretend I have a non-graffiti database with gig's of data that I want to display on the website using standard asp.net grid's and forms. I realize I could just go in and hack apart the source code to integrate my existing app, but that is likely not the correct approach.
Not looking for a complete solution her, just a pointer and what areas to investigate...thanks.
If you check out the latest source of Graffiti (or the 1.3 branch that was recently created), support was added to put widgets anywhere you want on any page. There is a new chalk function - $macros.Widget - that provides you with this ability. Dan Hounshell wrote a blog post on how you can use this new functionality:
http://danhounshell.com/blog/graffiti-cms-1-3-add-a-widget-anywhere-in-a-view-with-new-widget-macro/
If you're looking for something different than that, just let me know - we're working to make Graffiti even better for situations just like you are currently in.
What we have done to be able to integrate Graffiti CMS with our current ASP.NET projects is to create a post in Graffiti called "hidden" and then with our standard .ASPX pages we call a class in our Render Override that pulls the "hidden" post (ie: site.com/hidden/) and uses the header and footer to wrap the Graffiti theme around our custom .ASPX page. We use some HTML comments in the "hidden" post to be able to parse the header and the footer. It is kind of a hack, but has worked out really well for us.
I think you're trying to put the cart before the horse - depending on the size and amount of functionality, I would be looking to rebuild it after learning the development platform of my CMS system of choice.
I'm pretty much in the same boat right now. I have avoided Graffiti because I have to learn "Chalk" (whatever that is) and Umbraco (using XSLT for layouts is retarded). So far, this leaves me with Sitefinity at the top of my list and Telerik have just pulled the free version!
I may end up grabbing a very basic CMS which is easier to customize. I know this doesn't directly answer your question, but it may give you some food for thought :-)

How to theme a view in drupal

Can any one help me out on how to theme a view.
For each view created i want to have different templates.
Theming views can be somewhat tricky, depending on the kind of views you have created and the changes you need to make. Check out this introduction for Views 2, and make sure to install the Advanced Help module to get at the views2 documentation from the views module itself (there will be a link to the documentation on your views overview and edit pages, once you activated the Advanced Help module).
You can also find some questions/answers here on SO (e.g. Drupal 6: How to quickly theme a view?), if you search a bit.
I actually did this the other day. Ill give you a brief overview and expand a little later.
Set up your view; by going to Views -> Add View
Once, your view is completely set up, at the bottom of the view (left column in D6, right-most "Advanced" column in D7), you will see a link called "Theme: Information", click on it.
What you will be presented with is a list of templates (.tpl.php) files that the views uses to theme your data. Basically the file names that are bolded are the files views is using to theme the data.
To Customize Your Views
Select the page you need to theme. For Example, if you created a "Block" view, and I wanted to customize the basic html layout, I would pick a name (other than the one that is currently bolded) that is being displayed to me and create the file in my themes directory (sites/all/zen/custom-file-view-fields-views.tpl.php) - this is if views told me that I could use the filename custom-file-view-fields-views.tpl.php
The next step is knowing what code you need to put in there. The quickest way, is to go back to the theming information in views, click on the link of the file your replacing and grab the code that is presented to you. Paste that code in the file you created.
From here on out, you can now successfully customize that view.
Keep in mind that the theming information presented to you is presented from basic to complex (up to down). So choose which file you need to edit carefully. Ill put up some images in this answer a little later.
Hope this helps! Cheers!
Is there something specific you're trying to accomplish? There's a lot of ways to "theme" a view, unless you mean "theme" in the strict Drupal sense.
Personally I just give the fields classes and use those, rewriting the output to include variables as classes if need be. This tends to be easier and more manageable than modifying TPL files directly.

Customization of hook function

I Am new to drupal I need to customize core functionality like register module and event module.please share you thought / sample code / sample website for get the clarification over my issue
Thanks in advance
Balaji
From what you posted in the comment to creejayoz answer, it seems like what you are after is not using hook_form_alter, but something in the line of what the profile module does. It's part of drupal core, and with it you can add extra fields to the user like first and last name. There are also more advanced modules that you can use instead, but it seems like you wont need it. Using the profile module will also be a lot quicker and easier than using hook_form_alter as you wont need to create a db table make SQL and such to the save the data.
You can use hook_form_alter to heavily modify the way Drupal's registration works, by modifying the form's fields, adding extra validation/submit functions, etc. It's difficult to give more detail without knowing what you're wanting to do.

Resources