V
V
Vanes Ri_Lax2020-08-20 14:13:49
ASP.NET
Vanes Ri_Lax, 2020-08-20 14:13:49

How to dynamically insert inputs into a form?

Good afternoon, I am writing a simple application on asp.net webforms, c# programming language.
Here is my page code:

<%@ MasterType VirtualPath="~/Site1.Master" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Registration.aspx.cs" Inherits="LkMiac.Registration" MasterPageFile="~/Site1.Master" Title="Войти в личный кабинет"%>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<!-- Вот сюда мне нужно вставить код -->
</asp:Content>

I have to have a dynamic form, the field names come from another resource in json format. How can I implement this?
For the test, I created a simple element:
Label label = new Label();
label.Text = "Я это создал динамически";

And how can I add it to the part of the page I need?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2020-08-20
@firedragon

Create a user control in it after initialization add this.Controls.Add(label);

R
Roman, 2020-08-20
@yarosroman

Webforms has been dead for a long time, just wondering why?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question