Add a custom field in edit Page

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

Add a custom field in edit Page

Post by Thomas.Hoffner »

Hello

We added a column in the List Page in Event "ListOptions_Load" like that:

var opt = ListOptions.Add("kg_Value");
opt.Header = "Menge [kg]";
opt.OnLeft = false;     // Link on left
opt.MoveTo(0);        // Move to first column

Is it possible to add a custom field in Edit page in Event: Page_Load somthing like that:

        cField myfield =new cField(........
        myfield.FldName = "Hase";
        myfield.Visible = true;
        myfield.FldDbType = ewDbType.Float;
        myfield.CurrentValue = "888";

        Fields.Add("Thomas", myfield); 

????

I do not need the custom field in database.


motfs
User
Posts: 258

Post by motfs »

I would suggest to use Startup Script (Client Scripts -> Table-Specific -> Edit Page -> Startup Script) to create the field, e.g.:

$("<selector>").append("<HTML code>");


Thomas.Hoffner
User
Posts: 35

Post by Thomas.Hoffner »

Hello

Thanks for yout help !

I hve got the solition to add a value field (column) in the Edit-View. This Column ist not in the database table.

In the following example I add a field after the field "BES"
This JavaScript code I added in "ClientScripts/Table-Speciic/EditPage/StartupScript".

var html_text = "<tr id='r_BES_kg' @(Html.Raw(view_Tank.RowAttributes))>";
html_text = html_text + "<td class='ewTableHeader'><span id='elh_view_Tank_BES_kg'><table class='ewTableHeaderBtn'><tr><td>@Html.Raw(view_Tank.BES.FldCaption)</td></tr></table></span></td>";
html_text = html_text + "<td @(Html.Raw(view_Tank.SPEZ_GEW.CellAttributes))><span id=#el_view_Tank_BES_kg'>";
html_text = html_text + "<text>";
html_text = html_text + "<input type='text' name='x_BES_kg' id='x_BES_kg' size='30' value='@view_Tank.BES.EditValue' onchange='AWR_java_change_BES_kg(this.value);'/>";
html_text = html_text + "</text>";
html_text = html_text + "</span>@Html.Raw(view_Tank.SPEZ_GEW.CustomMsg)</td>";
html_text = html_text + "</tr>";

$("#r_BES").after(html_text);

I hope it is useful for other users.

Thomas Hoffner


Post Reply