iTemplate Formview Problem

  • Thread starter Thread starter Rbrt
  • Start date Start date
R

Rbrt

I have a Formview in my application which has code to dynamically create
templates at runtime. The code is in a custom class which implements
iTemplate. In the InstantiateIn method the code is supposed to construct the
appropriate template depending on what mode the Formview control is in. By
default it starts in Readonly mode and displays a record no problem. However,
I have a button elsewhere on the form to add a new record. The button click
event has a line to put the formview into insert mode using Changemode. The
problem is that InstantiateIn only seems to get called to produce a Header
and Footer when the formview is in insert mode. It does not get called to
create anything else. The only way I can get textboxes, what have you, into
the Formview in insert mode is to put them in the header. Has anybody else
run into this problem? I am obviously missing something.
 
Hi,

I am not quite sure about how you implemented your code but I would like to
remind you that FormView's EditItemTemplate and ItemTemplate properties must
be set separately. So, instead of checking the current mode of FormView, you
have to implement 2 different classes which implement ITemplate interface
and assign them to ItemTemplate and EditItemTemplate properties.

Hope this helps.

--
All the best,
Coskun SUNALI
MVP ASP/ASP.NET
http://sunali.com
http://www.propeople.dk
 
ARRRGHHH! How could I be so stupid? I was doing as you suggest but in the
code that creates the edit template, I had put
myformview.itemtemplate=new(....) instead of having code that says
myformview.edititemtemplate=new(....).

You have saved me from my own stupidity. Thank you!
 
Back
Top