how can i get field name on Custom View/Edit Tag

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
shahabksh
User
Posts: 9

how can i get field name on Custom View/Edit Tag

Post by shahabksh »

hi

i use Custom View tag in code part

who can i get currect fild name

@{
var return = CurrentPage.{{{name}}}.CurrentValue;
}
@
return

it's return x_CustomerName but this fild name is only CustomerName


Webmaster
User
Posts: 9427

Post by Webmaster »

{{{name}}} stands for the id or name attribute of the HTML element of the field, which is "x_<fieldname>". To output the field value only just use {{{value}}}. There is no tag for outputting the field name. Read "Field Setup" -> "Custom Edit Tag" in the help file for details.


shahabksh
User
Posts: 9

Post by shahabksh »

tanx for your help
i replace

var _return = CurrentPage.{{{name}}}.CurrentValue;
with
var _return = {{{value}}} + "my_string";

not how i can Set output to save fild in database (i use Custom Edit Tag)?


Webmaster
User
Posts: 9427

Post by Webmaster »

As explained in the help file, {{{value}}} is "the CurrentValue of the field object. It will converted to @<page>.<field>.CurrentValue. Note that it includes the @ tags, use it in HTML only, do not use it in C# code". So you code (in C#) will NOT work.

Since it is a Custom Edit Tag, your custom tag should provide a HTML form input element (which name should be {{{name}}}) in HTML so you field value can be submitted and saved.

Read "Field Setup" -> "Custom Edit Tag" in the help file carefully, read the examples, try to understand how it works first.


Post Reply