How to create cshtml file automatically? - asp.net-mvc-5

I'm using MVC 5 and want to create cshtml file automatically like a forum.
I have created a page to allow user posting new thread. When user submits, I will get the data from textarea and insert into database. I have done that control.
My question is: How to create a cshtml file to load data from database and display it automatically?
Example: I post a new thread with the title is: Here is my title. When I click submit, it will be converted to Here is my title
That mean: the controller NewThread and the view Here-is-my-title.cshtml had been created successfully.
Can you tell me how to do that?
p/s: I hope this is a clearly question. thank you!!!

If u use the entity framework model....u dont need to create a cshtml file ...it is created automatically
Follow this steps
1. Right Click The controller
2. Goto Add Controller
3. Then Choose The "MVC5 Controller With Views using Entity Framework"
there u can automatically create the controller and view

Related

Copying and Renaming xhtml file to new file in JSF causing data does not load

I received an assignment to have a look at Java Server Faces project and maintain the existing code if possible. My background is ASP.net , and never made a Java program previously. The problem is like this : there is existing file code named policy_list.xhtml (with also several beans attached to UI component in the file) and lets say it attach to menu Policy List. If user click the menu, the policy_list.xhtml will show the list of Policy. I copied the policy_list.xhtml file and renamed it to a new file renewal_list.xhtml. And I created a new menu Renewal List and attach the link to renewal_list.xhtml. I did not make any changes to renewal_list.xhtml. However , when I click the Renewal List menu, the page did not show any data like the Policy List menu. There is no error shown in the page What is wrong with the Renewal List page. Is it the behaviour of JSF ? On the IntelliJ IDEA debugger, I have not found any error. However the Search button in the renewal_list.xhtml working fine just as policy_list.xhtml. All the action link in the dataTable does not work in renewal_list.xhtml. I guess I am missing as particular setup on the menu or else ? Any ideas ?
My God, I have to registered it on pages.xml . Now, its working. Thanks to the powerful search of IntelliJ idea.

Custom Form issue - NGM Forum thread section in Orchard CMS

I am using the external module, NGM Forum.
In thread create form the Save button is not inside the <form> tag.
So when I press save it's not submitting the form.
How can I get the Save button back inside the form?
Please refer to the attached images:
Placement.info
It could be that you have customised the form somehow with your placement.info file and moved the save button down.
Edit form on create form?
Looking at the code from your screenshot it looks like you are on the /Create/ action, and your form tag confirms this with the id="thread-create". Code.
But the Save button is for the Edit action with submit.Save.
You must have made some mistakes with your changes before this point so you will need to explain how you built this form further I think for anyone to help you resolve it.

Command Not Handled Exception

I'm new to Domino Designer. I'm trying to modify an existing application which is running on a remote server. I create a blank xPage and view in browser and it works. I add a label and view in browser and it works. I add a combo box and setup a data source for my xPage. The data source is in the current application and I'm using a view. I setup my combo to point to that data source and specify BindTo value. I view it in browser and I get Error 500 "HTTP Web Server: Command Not Handled Exception" I can open the view that I've used and see all the data in the view. I can even add, edit, and delete from the view.
Ideas... Thnxs in advance.
Additional Info. I've added a "View" from "Container Controls" and used the same data source and the same view and it also works in the browser.
The error being printed is:
javax.faces.el.PropertyNotFoundException: Error getting property 'CompanyName' from bean of type lotus.domino.local.View
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:119)
com.ibm.xsp.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:144)
com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:182)
com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:163)
com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.j‌​ava:257)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:150) ....
This was already answered in the comments, but I want to write a better answer.
The problem in this case is that a view data source is being used for editing a document. Directly, this is not a possibility, though there are a few great ways to get around this. The first way, and my favorite, is to use an inline form. I think the Extension Library Demo database offers a few great examples of how to go about doing this. One way is to use a tooltip dialog. Another way is an inline form. A repeater is used and for every row in the view, a hidden panel can be made which contains the document data source and all field which are required to be changeable. By clicking on a button or link, the panel is made visible. This is my favorite variant because it is simple, quick, and generally looks great.
Another way to go about this is to have a view data source only, but use scripts to retrieve the document and set the values in the background and then save and release. It all depends on what you are trying to achieve.
My main recommendation is to look at the ExtLib demo and take a look at what they are doing there.

Opening different xpages forms from a view panel

I have an Xpages application that pulls data from another .nsf file. I have a view panel linked to a view in that db. The view has documents with several different forms in it. I want to be able to open each document in it's own form(xpage).
How do I write a computed At Runtime, open selected document using: statement that will select the correct Xpage to present the document.
If you use the Data View component instead of a View Panel, you can compute the pageName attribute, referencing the var attribute to return a different value for each row based on the document that row represents. The flexibility of the Data View component also makes it easier to make your app look more like a modern web application and less like an Excel spreadsheet. As an additional bonus, the mobile theme invokes a renderer that makes each Data View instance look like a native mobile list, so using Data Views instead of View Panels simplifies mobile development.
You have 2 options:
use "use xpage associated with form" and edit the form's property
use a SSJS formula to compute the Form. You provide a variable name in the view control var to access a view row as XSPViewEntry. If the Form is in a view column even one you don't display you use .getColumnValue otherwise getDocument.getItemValueString
Does that work for you?
Maybe this mothed can help you: Unable to get document page name for
Hope this helps
Mark
I had a similar problem today. I use only one form but 3 different xpages for associated with this form. I have 3 different document types in the view. I used rowData the get the type of the document.
try{
var v=rowData.getColumnValue("form");
if(v.indexOf("x")> -1){var page ="x.xsp"}
else if(v.indexOf("y") > -1){var page = "y.xsp"}
else{var page = "z.xsp"}
}catch(e){
var page = "x.xsp"
}
So to your view you can create a column with the value of the form and you can use it.
I have used the extension library Dynamic View control which has an event you can code to get a handle to the NotesViewEntry which was selected. See the demo database page Domino_DynamicView.xsp and the Custom Event Handler tab for an example.
Note, in 8.5.3 (I have not upgraded yet) if you add or edit the eventHandler for onColumnClick it will be added to the XPages source as an xe:eventHandler. It needs to be an xp:eventHandler to work. The way to do it is to copy the code in the source from the exiting event and delete it. Recreate the event and update the code. Then go back into the source and change the tags within the eventHandler to xp:.

Making the webform submission results as a link in Drupal 6?

I am a newbie in using Drupal 6 and I am still walking in the dark in terms of module familiarization and module configurations. Lately, I installed the Webform module for my site to be able to let users submit a request. In my Webform, there is a Select View field where it lists all contents of a specific Content Type on my Drupal site. I was able to use a View as a datasource for my normal webform select component via the Webform View Reference Component that's whay I have a custom <select> field which are views on my Webform. Now, after a successful submission of the form, I go to Results and found the data which are saved upon submission. What I want is that, on my Results page, the selected option from the list, which basically are views, will be a link to their respective views. This is how it looks like,
I am really lost right here. Can someone lend me a hand on how to make this possible? Cheers.
Install this module http://drupal.org/project/webform_report it will be displayed in table format and also you can customize the report & also It will create separate content type.
Below is the screen shot for webform report, you can also view, edit & delete from report itself.

Resources