"Joe Fallon" <jfallon1@nospamtwcny.rr.com> wrote in message
news:%23Abh47QbEHA.3524@TK2MSFTNGP12.phx.gbl...[color=blue]
> I agree.
> I did this with a DataGrid control and a custom collection.
> I have a button that says Add NewRecord.
> When it is clicked I add a blank row to my collection and re-bind it to[/color]
the[color=blue]
> grid.
> This works perfectly![/color]
Note that this isn't what the OP wanted. He wanted the added data to be
client-side until the user was done with the entire form. Also, he wasn't
talking about the typical datagrid. He was talking about a group of controls
which would repeat, once per input, but which could have new repeats added
to it on the client.
--
John Saunders
johnwsaundersiii at hotmail
[color=blue]
> "Dale" <daleDeletepres@msndotcomNot.Net> wrote in message
> news:%23LEhAXPbEHA.2972@TK2MSFTNGP12.phx.gbl...[color=green]
> > What you are trying to do is definitely possible in ASP.Net. It's not
> > exactly trivial but it also isn't terribly difficult once you get the[/color][/color]
hang[color=blue][color=green]
> > of the controls and classes involved. Undoubtedly, there are as many
> > possible ways to do it as there are readers of this board but if I were
> > doing what you're doing, I'd probably go like this:
> >
> > You could create a DataSet and a Repeater. Assign a table in the[/color][/color]
DataSet[color=blue]
> as[color=green]
> > the DataSource property of your Repeater using myRepeater.DataSource =
> > ds.Tables["myTable"];
> >
> > Create a new row by using the NewRow method of the table and add it to[/color][/color]
the[color=blue][color=green]
> > table with ds.Tables["myTable"].Rows.Add(newRow);
> >
> > Then use myRepeater.DataBind() to bind the table to your repeater. Now[/color]
> you[color=green]
> > have a blank row and it will display the same template as your populated
> > rows but the values will be null. Make sure you test for IsDbNull and
> > handle that in your repeater templates.
> >
> > In your ItemCommand handler of the repeater, you can save or cancel the[/color]
> new[color=green]
> > row on postback and, if appropriate, create a new blank row for the next
> > cycle.
> >
> > You could create your own repeater and inherit the
> > System.Web.UI.WebControls.Repeater and create your own template[/color][/color]
inheriting[color=blue][color=green]
> > the ITemplate interface.
> >
> > You can find a simple example of creating your own repeater at
> >
http://coltkwong.com/blogs/juliet/posts/467.aspx. The key thing on that
> > site is not her exact control but rather how simple it is to create a[/color]
> custom[color=green]
> > repeater. There are probably hundreds of other custom repeater examples[/color]
> on[color=green]
> > the net. I just know that I used her example as the starting point for
> > creating the repeater I am using in my current project at work and it[/color][/color]
has[color=blue][color=green]
> > made my life a lot easier.
> >
> > Some keywords you may want to look up on google and MSDN are IsDbNull,
> > ITemplate, Templated Controls, DataBind, TemplateItem,
> > Repeater.OnDataBinding.
> >
> > Hope that helps some,
> >
> > Dale
> >
> >
> > "Christoph" <jcboget@yahoo.com> wrote in message
> > news:#N79JVObEHA.2340@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > > > When building a form using Infopath, you can define a repeating
> > > > > section and stick form fields in that section. I'm curious if[/color][/color]
> ASP.NET[color=green][color=darkred]
> > > > > has a similar control to make it easy to design something similar
> > > > > using just ASP.NET (and not Infopath)? I'd hate to think that[/color][/color][/color]
I'll[color=blue][color=green][color=darkred]
> > > > > need to write all the javascript/dhtml to mimic that functionality[/color][/color]
> and[color=green][color=darkred]
> > > > > I don't really feel the need to re-invent the wheel.
> > > > > Has MS designed such a control? A 3rd party?
> > > > Are you familiar with the Repeater and DataList controls? They can[/color]
> > repeat[color=darkred]
> > > > arbitrary sets of controls for you, one set per input data item.
> > >
> > > I've looked at both of these and yes, they are really great for[/color][/color]
> repeating[color=green][color=darkred]
> > > data coming from a datasource. However, what I need is something
> > > that will repeat controls that will contain user input that will be[/color][/color]
> posted[color=green][color=darkred]
> > > back to the server and ultimately inserted into a datastore. These[/color][/color][/color]
are[color=blue][color=green][color=darkred]
> > > the two things I can't figure out from reading (what little)[/color][/color]
> documentation[color=green][color=darkred]
> > > on the repeating control:
> > >
> > > * How to repeat a set of empty controls on the client side. For[/color][/color]
> example,[color=green][color=darkred]
> > > let's say I have 3 input text boxes. Say, for 'First Name', 'Middle[/color]
> > Name',[color=darkred]
> > > 'Last Name'. And these text boxes appear on a form used to add people
> > > to a table in the data store. I can display the first row of those[/color][/color]
> blank[color=green][color=darkred]
> > > boxes
> > > no problem. But I'm not show how I can make it so that the end user[/color][/color][/color]
can[color=blue][color=green][color=darkred]
> > > make it so that another, blank, row appears so they can add multiple[/color]
> > people[color=darkred]
> > > in one shot.
> > >
> > > * Related to the above, assuming it is possible, how would those new
> > > controls be referenced in the code on the back end. It's easy enough[/color][/color][/color]
to[color=blue][color=green][color=darkred]
> > > reference the initial set of controls as I would just reference them[/color][/color][/color]
by[color=blue][color=green][color=darkred]
> > > name.
> > > What would be the names of the new, dynamically generated controls (ie
> > > the 3 input text boxes)?
> > >
> > > The above is the context with which I was asking my original question.
> > > I apologize for not being more clear.
> > >
> > > Thank you for your time and assistance!
> > >
> > > Christoph
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]