Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Object reference ot set to an instance of an object

$
0
0

System.NullReferenceException: Object reference ot set to an instance of an object?

I do not understand this error. I have been searching here in this fora but I do not find an answer. I have put an AsyncFileUpload in a FormView and it will not work.

I have copied my code below. Pls, can anyone help on this.

protected void UploadComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)

    {

        AsyncFileUpload AsyncFileUpload1 = (AsyncFileUpload)FormView1.FindControl("AsyncFileUpload");

        Label Label1 = (Label)FormView1.FindControl("Label1");

       string filePath = Server.MapPath("../files/");  AsyncFileUpload1.SaveAs(filePath);

    }

 

 

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/>

   

    <h2>

        </h2>

    <br />

    <br />

    <asp:FormView ID="FormView1" runat="server" DataKeyNames="id" DataSourceID="SqlDataSource1"

        DefaultMode="Insert" OnPageIndexChanging="FormView1_PageIndexChanging">

        <EditItemTemplate>

        </EditItemTemplate>

        <InsertItemTemplate>

            <table class="style1">

                    <td>

                        <asp:TextBox ID="dato" class="date" runat="server" Text='<%# Bind("date", "{0:d}") %>'></asp:TextBox>

                        <script type="text/javascript">

                            $(function () {

                                $('.dato').datepicker({

                                    numberOfMonths: 2,

                                    dateFormat: 'dd-mm-yy'

                                });

                            });

                        </script>

                    </td>

                    <td colspan="3">

                        <asp:TextBox ID="TextBox_Headlinie" runat="server" Width="500" Text='<%# Bind("headline") %>'></asp:TextBox>

                    </td>

                </tr>

            </table>

            <br />

          

            Tekst:

            <br />

            <cc1:Editor ID="Editor1" runat="server" content='<%#bind("Text") %>' Width="600" Height="300"/>

            <br />

           

          

            <ajaxToolkit:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnUploadedComplete="UploadComplete" 

            OnClientUploadComplete="showConfirmation"/>

            <asp:Label ID="Label1" runat="server"></asp:Label>

 

            <asp:TextBox ID="TextBox_sender" runat="server" Visible="false"></asp:TextBox>

          

            <br />

            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"

                Text="Insert" />

            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"

                CommandName="Cancel" Text="Cancel" />

        </InsertItemTemplate>

        <ItemTemplate>

        </ItemTemplate>

    </asp:FormView>

 

 

 

   

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>