问题描述:

I want to save my data in database with or without image but when I click on save button it show an error the object references not set when I put update panel this issue raised or when update panel removed no error shown please help me out.

<asp:UpdatePanel ID="UPPicture" runat="server" UpdateMode="Conditional">

<ContentTemplate>

<table>

<tr>

<td style="width:152px;">Asset Picture</td>

<td>

<asp:Image ID="AssetPic" runat="server" ImageUrl="~/images/defaultassetpic.jpg" Height="80px" Width="80px" />

</td>

</tr>

<tr>

<td>&nbsp;</td>

<td>

<input type="file" name="name" runat="server" id="ImageFileUpload" accept="image/*" onchange="previewFile()" onclick="return ImageFileUpload_onclick()" />

<br />

</td>

</tr>

<tr>

<td>

</td>

<td>

<asp:UpdatePanel ID="UPPictureView" runat="server">

<ContentTemplate>

<asp:Button ID="btnView" CssClass="btnControl" runat="server" Text="Uploaded View" Width="120px" ValidationGroup="None" OnClick="btnView_Click" />

</ContentTemplate>

</asp:UpdatePanel>

<asp:Label ID="lblMessage" Visible="false" Font-Bold="true" runat="server"></asp:Label>

</td>

</tr>

</table>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />

</Triggers>

</asp:UpdatePanel>

<br />

<table>

<tr>

<td>

<asp:UpdatePanel ID="UPButton" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">

<ContentTemplate>

<asp:Button ID="btnSave" CssClass="btnControl" runat="server" Text="S̲ave" Width="75px" AccessKey="S" OnClick="btnSave_Click" />

<asp:Button ID="btnUpdate" CssClass="btnControl" runat="server" Text="U̲pdate" Width="75px" AccessKey="U" OnClick="btnUpdate_Click" />

<asp:Button ID="btnDelete" CssClass="btnControl" runat="server" CausesValidation="false" Text="Del̲ete" Width="75px" AccessKey="L" OnClick="btnDelete_Click" />

<asp:Button ID="btnFind" CssClass="btnControl" runat="server" CausesValidation="false" Text="Fin̲d" Width="75px" AccessKey="N" OnClick="btnFind_Click" />

<asp:Button ID="btnClear" CssClass="btnControl" runat="server" CausesValidation="false" Text="C̲lear" Width="75px" AccessKey="C" OnClick="btnClear_Click" />

<asp:Button ID="btnReport" CssClass="btnControl" runat="server" CausesValidation="false" Text="R̲eport" Width="75px" AccessKey="R" onclick="btnReport_Click" />

<asp:Button ID="btnDocument" CssClass="btnControl" runat="server" CausesValidation="false" Text="Document̲s" Width="75px" AccessKey="T" onclick="btnDocument_Click" />

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />

<asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" />

<asp:AsyncPostBackTrigger ControlID="btnDelete" EventName="Click" />

<asp:AsyncPostBackTrigger ControlID="btnFind" EventName="Click" />

<asp:AsyncPostBackTrigger ControlID="btnClear" EventName="Click" />

<%--<asp:AsyncPostBackTrigger ControlID="btnReport" EventName="Click" />--%>

<asp:PostBackTrigger ControlID="btnReport" />

<asp:AsyncPostBackTrigger ControlID="btnDocument" EventName="Click" />

</Triggers>

</asp:UpdatePanel>

<asp:UpdateProgress ID="UPProgressButton" runat="server" DynamicLayout="true" AssociatedUpdatePanelID="UPButton" >

<ProgressTemplate>

<div id="blur" />

<div id="progress">

<asp:Image ID="Image" runat="server" ImageUrl="../Images/loader5.gif" Height="30px" Width="30px" />

</div>

</ProgressTemplate>

</asp:UpdateProgress>

相关阅读:
Top