0

我正在尝试从嵌套的 Obout SuperForm 更新 GridView 对象。但是,当我尝试访问 GridView 的 SuperForm 控件时,我的代码后面的方法不断返回 null,就像这样......

 protected void AwardsSuperForm_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            SuperForm sfAwards = AwardsOboutGrid.FindControl("AwardsSuperForm") as SuperForm;

        }

这总是空的,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>
4

0 回答 0