Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FormView: Can we have one template for EditItemTemplate, InsertItemTemplate and ItemTemplate?

Reply
Thread Tools

FormView: Can we have one template for EditItemTemplate, InsertItemTemplate and ItemTemplate?

 
 
Max2006
Guest
Posts: n/a
 
      08-24-2007
Hi,

I have a form that the contents of EditItemTemplate, InsertItemTemplate and
ItemTemplate are the same, so repeating the same content 3 times is
redundant. Is there any way to share all the contents?

Thank you,
Max


 
Reply With Quote
 
 
 
 
Muhammad Naveed Yaseen
Guest
Posts: n/a
 
      08-25-2007
Yes, I often do that. I define one template with conditional rendering
at appropriate places depending on container's mode, and then in Init
event I assign this to other templates (like
FormView1.InsertItemTemplate = FormView1.UpdateItemTemplate).

Same goes for DataSource controls' update/insert parameter collections
(if those are reasonably similar), with difference being adjusted in
Init event.

 
Reply With Quote
 
 
 
 
Muhammad Naveed Yaseen
Guest
Posts: n/a
 
      08-25-2007
However make sure doing this doesn't take away the feeling of multiple
instances of this template, as they can and will exist. Once I ruined
whole night in trying to debug a mysterious 'state loss' at insert
event, only to realize that there is (and should be) a new instance of
this template for update after insert

 
Reply With Quote
 
Muhammad Naveed Yaseen
Guest
Posts: n/a
 
      08-25-2007
Yes, I often do that. I define one template with conditional rendering
at appropriate places depending on container's mode, and then in Init
event I assign this to other templates (like
FormView1.InsertItemTemplate = FormView1.EditItemTemplate).

Same goes for DataSource controls' update/insert parameter collections
(if those are reasonably similar), with difference being adjusted in
Init event.


However make sure doing this doesn't take away the feeling of multiple
instances of this template, as they can and will exist. Once I ruined
whole night in trying to debug a mysterious 'state loss' at insert
event, only to realize that there would be (and should be) new
instance of this template in update mode after insert



 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      08-29-2007
Hi Max,

Muhammad's suggestions seems useful, have you tried it? Do you need
anything else in this question?


Regards,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unique IDs in FormView InsertItemTemplate and EditItemTemplate hooterbite@yahoo.com ASP .Net 1 05-19-2008 12:53 AM
InsertItemTemplate and ControlParameter npei72@gmail.com ASP .Net 2 02-06-2007 08:49 PM
Can I combine an EditItemTemplate and InsertItemTemplate? pjbates ASP .Net 1 05-02-2006 03:00 AM
Databinding in InsertItemTemplate of FormView Swetha ASP .Net 0 11-14-2005 09:53 AM
Samsung SCD6040 - Anyone have one, used one, or have reviews on one? g wills Digital Photography 0 09-08-2004 08:06 PM



Advertisments