Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

iTemplate Formview Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rbrt - 07 Feb 2008 12:19 GMT
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.
Coskun SUNALI [MVP] - 07 Feb 2008 13:37 GMT
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.

Signature

All the best,
Coskun SUNALI
MVP ASP/ASP.NET
http://sunali.com
http://www.propeople.dk

>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
[quoted text clipped - 13 lines]
> the Formview in insert mode is to put them in the header. Has anybody else
> run into this problem? I am obviously missing something.
Rbrt - 07 Feb 2008 14:08 GMT
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!

> Hi,
>
[quoted text clipped - 23 lines]
> > the Formview in insert mode is to put them in the header. Has anybody else
> > run into this problem? I am obviously missing something.
Coskun SUNALI [MVP] - 07 Feb 2008 14:29 GMT
Hi,

You are welcome. Should you have any problems in advance, please do not
hesitate to keep asking in the newsgroups.

Signature

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
[quoted text clipped - 38 lines]
>> > else
>> > run into this problem? I am obviously missing something.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.