ネストされたOboutSuperFormからGridViewオブジェクトを更新しようとしています。ただし、私のコードビハインドメソッドは、GridViewのSuperFormコントロールにアクセスしようとすると、nullを返し続けます...
protected void AwardsSuperForm_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{
SuperForm sfAwards = AwardsOboutGrid.FindControl("AwardsSuperForm") as SuperForm;
}
これは常にnullであり、GridViewのFindControlメソッドは、ネストされた要素であっても「AwardsSuperForm」を認識できません。これがASPマークアップです...
<obout:Grid ID="AwardsOboutGrid" runat="server" Serialize="true" AutoGenerateColumns="false"
OnInsertCommand="InsertRecordGrid" OnDeleteCommand="DeleteRecordGrid" OnUpdateCommand="UpdateRecordGrid"
PageSize="50" AutoGenerateRows="false" AutoGenerateInsertButton="true"
AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" OnRebind="RebindForm">
<Columns>
<obout:Column AllowEdit="true" AllowDelete="true" HeaderText="Edit" Width="100"/>
<obout:Column ID="ID" DataField="ID" ReadOnly="true" Visible="false" runat="server">
<TemplateSettings RowEditTemplateControlID="ID" RowEditTemplateControlPropertyName="value" />
</obout:Column>
<obout:Column ID="OrgName" DataField="OrgName" HeaderText="Organization Name" Width="250" runat="server">
<TemplateSettings RowEditTemplateControlId="SuperForm_OrgName" RowEditTemplateControlPropertyName="value" />
</obout:Column>
<obout:Column ID="AwardName" DataField="AwardName" HeaderText="Award" runat="server">
<TemplateSettings RowEditTemplateControlId="SuperForm_AwardName" RowEditTemplateControlPropertyName="value" />
</obout:Column>
<obout:Column ID="Date" DataField="Date" HeaderText="Date Due" HtmlEncodeFormatString="True" HtmlEncode="True" runat="server">
<TemplateSettings RowEditTemplateControlId="SuperForm_Date" RowEditTemplateControlPropertyName="value" />
</obout:Column>
<obout:Column ID="Link" DataField="Link" HeaderText="Link" Width="222" runat="server">
<TemplateSettings RowEditTemplateControlId="SuperForm_Link" RowEditTemplateControlPropertyName="value" />
</obout:Column>
</Columns>
<TemplateSettings RowEditTemplateId="AwardsTplRowEdit" />
<Templates>
<obout:GridTemplate runat="server" ID="AwardsTplRowEdit">
<Template>
<input type="hidden" id="ID" />
<obout:SuperForm ID="AwardsSuperForm" runat="server"
DataSourceID="AwardsObjectDataSource" AutoGenerateRows="false"
AutoGenerateInsertButton="True" AutoGenerateEditButton="True"
AutoGenerateDeleteButton="false" DataKeyNames="ID" DefaultMode="Edit"
OnItemInserting="AwardsSuperForm_ItemInserting"
OnItemUpdating="AwardsSuperForm_ItemUpdating"
Width="99%">
<Fields>
<obout:BoundField DataField="OrgName" HeaderText="Organization Name" FieldSetID="FieldSet1" />
<obout:BoundField DataField="AwardName" HeaderText="Award Name" FieldSetID="FieldSet1" />
<obout:DateField DataField="Date" HeaderText="Date Due" FieldSetID="FieldSet2"
DataFormatString="{0:MM/dd/yyyy}" ApplyFormatInEditMode="true"/>
<obout:BoundField DataField="Link" HeaderText="Link" FieldSetID="FieldSet2" />
</Fields>
<FieldSets>
<obout:FieldSetRow>
<obout:FieldSet ID="FieldSet1" Title="Award Information" />
<obout:FieldSet ID="FieldSet2" Title="Date Information" />
</obout:FieldSetRow>
<obout:FieldSetRow>
<obout:FieldSet ID="FieldSet3" ColumnSpan="3" />
</obout:FieldSetRow>
</FieldSets>
</obout:SuperForm>
</Template>
</obout:GridTemplate>
</Templates>
</obout:Grid>