Whenever u create a View for new create thread or edit thread what u get is a text box. I need a Text area to be displayed for writing how should i go about it.
#Html.TextArea or #Html.TextAreaFor
Same as the other HTML helpers.
You can also add the following annotation to your model
[DataType(DataType.MultilineText)]
When you call EditorFor you'll get a textarea rather than a textbox.
If you're talking about actually changing the scaffolding template, you need to create your own template.
Related
I’m trying to create a multipage HMI in "Twincat3 Beckhoff".
The problem is when we use to bring to front other keys are useless.
when we use to send to back we have problems such as the other keys don't work correctly. I want to open a separate page.
What you're looking for are .content files. As explained on InfoSys:
Creating navigation
Switch to the Solution Explorer.
Add the desired number of content objects:
1 Right-click on the TwinCAT HMI project entry or on one of the
folders.
2 Select Add and New Item and select Content.
Open the view or the content where you wish to add the navigation.
Add a region and buttons in order to switch between the contents.
Set the Target Content attribute in order to define the start content.
Add a SetTargetContent action to the .onPressed event of all buttons and set the corresponding content.
You can hide all the objects you do not want to be displayed by coding on the New Page Call Button.
TcHmiButton::Visibility = hidden[enter image description here][1]
The second solution is to make the page we want to call small, but increase the width and height of the page to be coded by coding in the desired button.
I would kindly ask for your help :) From couple of days I am trying to achieve "linked" custom field in content editor and dropdown in page editor.
Basically I want to have dropdown in page editor and content editor which are responsible for a same thing.
In my c# code i have enums which represent directions. I created custom field which accepts assembly and class with overridden onload method and successfully populate dropdown values in the content editor. So far so good but i have no idea how to create dropdown which will represent the same functionality inside page editor.
So please give me any ideas...
Judging from your reply to my comment you need to think of the following: How is my field value being rendered onto a page?
If you are always using 1 control to do this then you just need to ensure that this control has 2 different rendering modes depending on the Context.PageMode
But as I understand it you want this dropdown to also appear when someone renders your custom field using a <sc:FieldRenderer>. In this case you'll need to look into the RenderField pipeline of Sitecore. There you find a processor called RenderWebEditing. Possibly through some manipulation here you can get your dropdown appear as you wish.
I have a model with 5-6 properties. Rather than tediously writing a line of code to create a textbox in the view, is it possible to loop through all the properties in the model (which are public) and create a textbox in the view for each iteration?
Thanks
Yes you can use #Html.EditorForModel() or if you want more granular control you can generate the textboxes with the help of a little reflection:
#foreach (var property in Model.GetType().GetProperties())
{
#Html.Label(property.Name)
#Html.TextBox(property.Name)
}
There is a built-in feature for this. #Html.EditorForModel() will spit out the appropriate editor controls for each field. Read up on the "editor templates" feature in MVC to understand how this works, how to customize it, etc.
I've already created a custom module that overrides the sales/order/view/tab/info.phtml layout file and creates a new field in the sales_flat_order table. Now I need figure out how to add a text input field to the order page:
The save button doesn't necessarily need to be right near the custom field and the field doesn't need to necessarily appear right where I put it in the graphic. Bottom line is, the administrator needs to be able to edit my new custom field in the admin.
What is the best way to do that?
Look at Comments History block
implementation - class Mage_Adminhtml_Block_Sales_Order_View_History, its template \app\design\adminhtml\default\default\template\sales\order\view\history.phtml and Mage_Adminhtml_Sales_OrderController::addCommentAction(). You should create similar block class with similar template and create controller with action which will save form data to your db field.
I have a Form to create a new model object and persist it. That form is displayed in a lightbox or popup.
Some fields are dropdownlist showing related info that lives in another table (other model object related to the main model).
What I need to achieve is without leaving the creation form, create a new item of the related type and update the DropDownList in order to continue filling fields and finaly submit the form.
I have done this in winforms but not really sure which is the best approach in MVC 3:
Trigger another popup with a small form?
Use some kind of editable dropdownlist?
Place a small hidden form right next/after the DDL to allow entering the info to create an item in DDL (and to DB also)?
What do you thing is the best option?
Thanks!
There is no editable dropdown list in HTML. There are some toolkits that simulate it, but in general these are clumbsy and really complex. It's a lot easier to stick with basic controls.
You would proably do best to have a small + sign next to the field, and then popup an editing field that inserts the element into the combobox and sends it to the controller via ajax to add to the database.
An alternative to a second pop up is having a toggle add button. When toggled, then show a small area where you can enter the name. Using ajax, save the name, and then refresh your dropdown. This works well if you only have a few attributes to fill in.