iTemplate Formview Problem

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.
 
C

Coskun SUNALI [MVP]

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
 
R

Rbrt

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top