|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionWhen I got my new job, I found out that developers there were still thinking in .NET 1.1, so they used old methods or directly edited HTML in BackgroundLet's start designing:
Points of interestThe control itself is not complicated, so I will not describe all the code, I'll mention only the interesting parts.
[PersistenceMode(PersistenceMode.InnerProperty),
TemplateContainer(typeof(GridViewRow),
System.ComponentModel.BindingDirection.TwoWay)]
public IBindableTemplate EditItemTemplate
{
set { _EditItemTemplate = value; }
get { return _EditItemTemplate; }
}
The interesting thing about this snippet is the attribute. Ordinary protected override void ExtractRowValues(
System.Collections.Specialized.IOrderedDictionary fieldValues,
GridViewRow row, bool includeReadOnlyFields, bool includePrimaryKey)
{
if (_EnableTemplateEditing)
{
// Not working
// fieldValues = _EditItemTemplate.ExtractValues(row.Cells[0]);
// Working
IOrderedDictionary dict = _EditItemTemplate.ExtractValues(row.Cells[0]);
foreach (string s in dict.Keys)
fieldValues.Add(s, dict[s]);
}
else
base.ExtractRowValues(fieldValues, row, includeReadOnlyFields,
includePrimaryKey);
}
The strange thing is that you can not assign the To enable template editing, don't forget to set the History
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||