0

请我有这个错误,我无法摆脱它我在另一个用户控件中有一个用户控件,子控件包含 RadAjaxPanel。

父控件包含一个 Radgrid 希望有一个 editformTemplate 并在其中加载子控件我将在代码中向您展示:

<EditFormSettings EditFormType="Template">
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
                <FormStyle BackColor="#FCFCFC"></FormStyle>
                <FormTemplate>
                       <table>
                            <tr>
                                <td class="LblWidth" style="padding-top: 5px;">
                             <asp:Label ID="Label1" runat="server" Text="Center logo:">
                                    </asp:Label>
                                </td>
                                <td style="padding-top: 10px;">

                 <uc1:MAYAUploadImageControl ID="UploadImageControl1" runat="server" />


                                    <span class="redSpan">
                                    </span>
                                </td>
                            </tr>
                        </table>
   </FormTemplate>
            </EditFormSettings>

那是父控件

子控件是:

<telerik:RadAjaxPanel ID="ajaxPanel" runat="server" >
    <asp:HiddenField ID="hf_FileName" runat="server" />
    <asp:HiddenField ID="ImageChanged" runat="server" Value="0" />
    <asp:Label ID="Label1" runat="server" Text="New Picture:"></asp:Label>
    <br />
    <telerik:RadImageEditor ID="RIEditor" runat="server" Width="180" Height="150" ToolBarMode="Default"
        EnableResize="false" EnableTheming="false" BackColor="Transparent" OnImageSaving="ImageEditor_ImageSaving"
        StatusBarMode="Hidden" CanvasMode="No" ToolBarPosition="top" BorderStyle="Solid"
        BorderWidth="0px" Visible="false" OnClientImageLoad="ImageLoad" OnClientImageChanged="ImageChanged">
        <Tools>
            <telerik:ImageEditorToolGroup>
                <telerik:ImageEditorTool CommandName="Flip" />
                <telerik:ImageEditorTool CommandName="FlipVertical" />
                <telerik:ImageEditorTool CommandName="FlipHorizontal" />
                <telerik:ImageEditorToolSeparator />
                <telerik:ImageEditorTool CommandName="Crop" />
                <telerik:ImageEditorTool CommandName="Resize" />
                <telerik:ImageEditorToolSeparator />
                <telerik:ImageEditorTool CommandName="Reset" />
            </telerik:ImageEditorToolGroup>
        </Tools>
    </telerik:RadImageEditor>
    </telerik:RadAjaxPanel>

父控件 ascx.cs:

 protected void GridCenters_ItemCommand(object sender,Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.UpdateCommandName || e.CommandName == RadGrid.PerformInsertCommandName)
    { controls_CustomControls_UploadImageControl_Maya ctrl = e.Item.FindControl("UploadImageControl1") as controls_CustomControls_UploadImageControl_Maya;
        if (ctrl.ImageFileName != "")
        {
            //string imageFileName = (e.Item.FindControl("AsyncUpload1") as RadAsyncUpload).UploadedFiles[0].FileName;
            ctrl.SaveImage();
            logo = ctrl.ImageFileName != "" ? ConvertImgToBinary(ctrl.ImageFileName) : null;
        }

        switch (e.CommandName)
        {
 case "Update":
    if(!EntertainmentDataAccess.UpdateCenter(long.Parse(e.CommandArgument.ToString()), centerName, centerType, logo, website, "", isactive, "", mail, tel, Mobile, fax, country, casa, town, street, BuildNb, POB))
                {
                    LblError.Text = "Branch cannot be updated";
                }
                else
                {
                    LblError.Text = "Branch updated successfully";
                    GridEditCommandColumn editColumn = (GridEditCommandColumn)GridCenters.MasterTableView.GetColumn("EDIT");
                    editColumn.Visible = true;

                    GridCenters.DataBind(); // here i'm getting the error
                }
                break;
        }
    }

我很抱歉我的解释混乱,但我在这个问题上被困了好几天,我没有解决它

4