I just thought I'd add a beginning to the solution I am searching for.
First a simple test.aspx:

<asp:UpdatePanel ID="uPanel" runat="server" ChildrenAsTriggers="true"
UpdateMode="Conditional" >
<ContentTemplate>
    <asp:PlaceHolder ID="place1" runat="server">

    </asp:PlaceHolder>
    <asp:Button ID="btnAdd" runat="server" Text="Add row"
OnClick="addBtn_Click" />
</ContentTemplate>
</asp:UpdatePanel>

And the code-behind:
private static int counter = 0;

protected void Page_Load(object sender, EventArgs e)
{

}

protected void addBtn_Click(object sender, EventArgs e)
{
    counter++;
    TextBox txt = new TextBox();
    txt.Text = "Text #" + counter.ToString() + " - " +
DateTime.Now.ToString();
    place1.Controls.AddAt(place1.Controls.Count - 1, txt);
}

When I click the button it takes ages (it seems compared to the
javascript solution, before the TextBox appears. However as I click
the button once more (in order to theoretically get another row) the
TextBox is only replaced by a new TextBox with updated number and
time.

What am I doing wrong?


On 3 Nov, 07:41, Cerebrus <[EMAIL PROTECTED]> wrote:
> I don't know, but my suggestion was in line with your Javascript based
> solution in which controls are dynamically created on the client, and
> then the form can be submitted to the server. Using a GridView would
> mandate postbacks which would defeat the purpose of dynamic rows.
>
> On Nov 3, 1:06 am, royend <[EMAIL PROTECTED]> wrote:
>
> > I think you misunderstood my problem:
> > First of all: the number of participants is unknown and a organization
> > might register only 1 or maybe 30 participants. Therefore I need the
> > form to be dynamic with regards to the number of rows.
>
> > Secondly: I need the sending of data to happen in one go. The
> > "regular" solution to create dynamic rows with a gridview in .NET
> > needs to send data with every participant and is more difficult to
> > edit "live".
>
> > Hopefully this made things clearer.
> > royend.
>
> > On 2 Nov, 16:07, Cerebrus <[EMAIL PROTECTED]> wrote:
>
> > > Why not have a "Save" button at the bottom, which allows a user to
> > > submit all created participants to the database in one go, instead of
> > > pushing data to the DB everytime a row insert is made ?
>
> > > On Nov 2, 4:07 pm, royend <[EMAIL PROTECTED]> wrote:
>
> > > > Hi.
>
> > > > I am looking for a .NET solution on how to make a form where I can add
> > > > rows dynamically without pushing data to a database before every row
> > > > (e.g. participants) have been registered. I know one solution is to
> > > > add an insert-row at the bottom of a gridview, but this is not very
> > > > intuitive for my users and requires pushing data to a database which
> > > > creates a lot of requests to the database.
>
> > > > I have created a simple javascript-solution to my problem and you
> > > > might want to see it 
> > > > at:http://www.absentia.no/kalender.html(don'tmindthelook of it...
> > > > it's very simple.)
>
> > > > However, I still want this done with .NET-elements, like
> > > > <asp:TextBox... /> since these give better performance when using
> > > > codebehind and provide the opportunity to use custom user controls.
> > > > Does any of you know of a solution where I can achieve the same
> > > > instant dynamic form (excluding the aforementioned gridview
> > > > solution...)?
>
> > > > Looking forward to your replies.
>
> > > > Best regards,
> > > > royend- Hide quoted text -
>
> > - Show quoted text -

Reply via email to