This is a migrated thread and some comments may be shown as answers.

Ajax Error on XP

11 Answers 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 15 Feb 2012, 03:40 PM
We have multiple telerik controls on a page and any time you click on the in IE 8 on a win xp machine we get the error attached. Do you know of any solution for this? I should note that the commands (such as a delete command in a gridview, an upload command, etc) actually work, it just pops up with that ajax error every time. Any ideas?

11 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 20 Feb 2012, 12:17 PM
Hello,

Please ensure that you are registering the needed handlers for the RadUpload control as described in the following help topic.
Follow the described steps and let me know if this makes a difference.

Kind regards,
Maria Ilieva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Web Services
Top achievements
Rank 2
answered on 20 Feb 2012, 05:29 PM
Adding those two lines for IIS 7 breaks my site. I have a button that shows an tool tip and if I add those, the pop up error goes away, but when I try to show the tool tip, it gives me this error. If I remove those lines, then the pops up come back, but the site works. Any ideas?

Server Error in '/' Application.
--------------------------------------------------------------------------------


Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 


Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.


Source Error: 


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  


Stack Trace: 




[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.RadUploadHttpModule.SetTextContent(Type workerRequestType, HttpWorkerRequest workerRequest, Byte[] textContent) +162
   Telerik.Web.UI.RadUploadHttpModule.Context_BeginRequest(Object sender, EventArgs e) +378
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


 




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456 
0
Maria Ilieva
Telerik team
answered on 23 Feb 2012, 10:22 AM
Hello,

Unfortunately the provided errors does not give enough information so we could isolate the root cause of the issue. Therefore I would suggest you to open a regular support ticket and send us runnable version of your ablactation as well as detailed steps for replicating the issue on our end. Thus we will be able to debug the project locally and do our best to provide proper solution.

Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 23 Feb 2012, 03:40 PM
I don't have it in my budget to renew my license until next month. Does that mean I'll have to wait until then? I can provide anything you need to an email.
0
Maria Ilieva
Telerik team
answered on 24 Feb 2012, 01:39 PM
Hello,

In this case the best option would be to paste here runnable version of your code which we can use locally to create a project and do the needful to isolate the root cause of the problem.

Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 24 Feb 2012, 04:38 PM
So this page is really complicated and it would take me a long time to get something you could use. However, I can provide you with the code here, and access to my dev site so you can reproduce it. Just go here http://parts.intellicomweb.com/admin/products/product.aspx?id=-163 login with testadmin t3st@dm1n and click the add drawing button towards the bottom. Here is the code running on that page

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.Master"
    Theme="MainTheme" CodeBehind="Product.aspx.vb" Inherits="devOrthman.Product"
    Title="Product Page" %>
 
<%@ Register Assembly="Validators" Namespace="Sample.Web.UI.Compatibility" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="SPIWebControls" Namespace="SPI.SecureObjects" TagPrefix="spi" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .myHeader
        {
            border-bottom: 1px solid #c3c3c3;
            color: #336600;
            font-size: 12px;
            text-align: left;
        }
        .myItem
        {
            padding-top: 10px;
            font-size: 12px;
        }
    </style>
    <script type="text/javascript">
 
        function validateManualRadUpload(source, arguments) {
            arguments.IsValid = $find('ctl00_ContentPlaceHolder1_manualRadUpload').validateExtensions();
        }
 
        function validateImageRadUpload(source, arguments) {
            arguments.IsValid = $find('ctl00_ContentPlaceHolder1_ImageRadUpload').validateExtensions();
        }
 
        function validatePDFRadUpload(source, arguments) {
            var upload = $find('ctl00_ContentPlaceHolder1_DrawingPDFRadUpload')
            if (upload.validateExtensions()) {
                var fileInputs = upload.getFileInputs();
                for (var i = 0; i < fileInputs.length; i++) {
                    if (fileInputs[i].value && fileInputs[i].value.length > 0) {
                        arguments.IsValid = true;
                    }
                    else {
                        arguments.IsValid = false;
                    }
                }
            }
            else {
                arguments.IsValid = false;
            }
        }
        function validatePartsRadUpload(source, arguments) {
            var upload = $find('ctl00_ContentPlaceHolder1_PartsRadUpload')
            if (upload.validateExtensions()) {
                var fileInputs = upload.getFileInputs();
                for (var i = 0; i < fileInputs.length; i++) {
                    if (fileInputs[i].value && fileInputs[i].value.length > 0) {
                        arguments.IsValid = true;
                    }
                    else {
                        arguments.IsValid = false;
                    }
                }
            }
            else {
                arguments.IsValid = false;
            }
        }
  
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="SubmitDrawingButton">
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <br />
    <table cellspacing="7">
        <tr>
            <td valign="top" align="right" class="H2Internal" style="width: 82px">
                Name:
            </td>
            <td style="width: 424px">
                <telerik:RadTextBox ID="NameTextBox" runat="server" EmptyMessage="Product Name" Skin="Vista"
                    BorderColor="#B1CABA" BorderStyle="Solid" BorderWidth="1px" CssClass="H3Internal">
                    <EmptyMessageStyle Font-Italic="True" />
                    <HoveredStyle CssClass="h3Internal" />
                </telerik:RadTextBox>
                 <cc1:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="NameTextBox"
                    ErrorMessage="Product Name is Required." ValidationGroup="ProductValidation"
                    CssClass="H3Internal"></cc1:RequiredFieldValidator
                <spi:SPIValidator ID="SPIValidator1" runat="server" AllowPattern="[\s\x21-\x7E\xA0-\xFF]*"
                    ControlToValidate="NameTextBox" Display="Static" DenyPattern="All" ErrorMessage="*"
                    MaxLength="75" ReplacePattern="$0" IgnoreCase="True" ValidationGroup="ProductValidation"></spi:SPIValidator>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" class="H2Internal" style="width: 82px">
                Product Line:
            </td>
            <td style="width: 424px">
                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" HorizontalAlign="NotSet"
                    EnableHistory="True" LoadingPanelID="RadAjaxLoadingPanel1">
                    <telerik:RadTreeView ID="RadTreeView1" runat="server" DataFieldID="CategoryId" DataSourceID="CategoriesSqlDataSource"
                        ValidationGroup="categoryValidation" Skin="Vista" DataTextField="Name" LoadingStatusPosition="BeforeNodeText"
                        Height="120px" OnDataBound="selectFirstNode" OnNodeClick="getNodeValue" DataFieldParentID="ParentId"
                        DataValueField="categoryID" BorderColor="#B1CABA" BorderStyle="Solid" BorderWidth="1px"
                        CausesValidation="False">
                        <CollapseAnimation Duration="100" Type="OutQuint" />
                        <ExpandAnimation Duration="100" />
                    </telerik:RadTreeView>
                </telerik:RadAjaxPanel>
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
                    MinDisplayTime="1000" Transparency="30" Width="75px" BackColor="LightGray">
                    <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
                        style="border: 0px;" />
                </telerik:RadAjaxLoadingPanel>
            </td>
        </tr>
        <tr>
            <td valign="top" align="right" style="height: 131px; width: 82px;" class="H2Internal">
                Description:
            </td>
            <td valign="top" style="height: 131px; width: 424px;">
                <asp:TextBox ID="descriptionTextBox" runat="server" TextMode="MultiLine" Rows="5"
                    Columns="50" MaxLength="250" BorderColor="#B1CABA" BorderStyle="Solid" BorderWidth="1px"
                    CssClass="H3Internal"></asp:TextBox><br />
                <cc1:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="descriptionTextBox"
                    ErrorMessage="Product Description is Required." ValidationGroup="ProductValidation"
                    CssClass="H3Internal"></cc1:RequiredFieldValidator>
                <br />
                <telerik:RadSpell ID="spell1" runat="server" ControlToCheck="descriptionTextBox"
                    DictionaryPath="~/App_Data" ButtonType="PushButton" Skin="Vista" SpellCheckProvider="TelerikProvider" />
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" class="H2Internal" style="width: 82px">
                Manual:
            </td>
            <td valign="top" style="width: 424px;">
                <telerik:RadUpload ID="manualRadUpload" runat="server" Skin="Vista" AllowedFileExtensions=".pdf,.doc"
                    ControlObjectsVisibility="ClearButtons" ReadOnlyFileInputs="True" BorderStyle="Solid"
                    BorderWidth="1px" BorderColor="White" />
                <asp:HyperLink ID="ManualHyperLink" runat="server" BorderColor="#B1CABA" BorderStyle="Solid"
                    BorderWidth="1px">[ManualHyperLink]</asp:HyperLink
                <asp:Button ID="deleteManualButton" runat="server" Text="Delete" CausesValidation="False" />
                <br />
                <asp:CustomValidator ID="manualCustomValidator" runat="server" ClientValidationFunction="validateManualRadUpload"
                    Display="Dynamic" ErrorMessage="Invalid file extension." ValidationGroup="ProductValidation"
                    CssClass="H3Internal"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" class="H2Internal" style="width: 82px">
                Image:
            </td>
            <td valign="top" style="width: 424px">
                <asp:Panel ID="ImageUploadPanel" runat="server">
                    <telerik:RadUpload ID="ImageRadUpload" runat="server" AllowedFileExtensions=".jpeg,.jpg"
                        ControlObjectsVisibility="ClearButtons" ReadOnlyFileInputs="True" Skin="Vista"
                        BorderStyle="Solid" BorderWidth="1px" BorderColor="White" />
                    <br />
                    <asp:CustomValidator ID="imageCustomValidator" runat="server" ClientValidationFunction="validateImageRadUpload"
                        Display="Dynamic" ErrorMessage="Invalid file extension." ValidationGroup="ProductValidation"
                        CssClass="H3Internal"></asp:CustomValidator>
                </asp:Panel>
                <asp:Panel ID="ImagePanel" runat="server">
                    <asp:Image ID="ProductImage" runat="server" Height="125px" Width="125px" />
                    <br />
                    <asp:Button ID="deleteButton" runat="server" Text="Delete" CausesValidation="False" /></asp:Panel>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" style="width: 82px">
            </td>
            <td style="width: 424px">
                <!-- 20120130 update by michael andrews having problems with the rad grid delete
                     so I just created a normal grid view -->
                <p>
                    <telerik:RadGrid ID="newDrawing" runat="server" GridLines="None" AutoGenerateColumns="false"
                        Skin="Telerik">
                        <MasterTableView DataKeyNames="drawingId">
                            <Columns>
                                <telerik:GridBoundColumn HeaderText="Name" DataField="name" SortExpression="name"
                                    UniqueName="name" HeaderStyle-Width="300px">
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="delete" Text="Delete">
                                </telerik:GridButtonColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                    <!-- 2012-01-31 Removed by michael andrews because delete button was throwing wierd error -->
                    <%--
                     <telerik:RadGrid ID="drawingsGrid" runat="server" AllowPaging="True" GridLines="None"
                        DataSourceID="drawingsSqlDataSource" AutoGenerateColumns="False"
                    Skin="Telerik">
                        <MasterTableView DataKeyNames="drawingId"
                            AllowAutomaticDeletes="True" DataSourceID="drawingsSqlDataSource">
                            <RowIndicatorColumn
                                Visible="False">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn
                                Visible="False" Resizable="False">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" UniqueName="Name">
                                    <HeaderStyle ForeColor="#336600"
                                        Height="23px" Width="200px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this drawing? "
                                    CommandName="Delete"
                                    Text="Delete" UniqueName="columnDelete">
                                    <HeaderStyle ForeColor="White"
                                        Height="23px" Width="50px" />
                                    <ItemStyle BorderWidth="1px" />
                                </telerik:GridButtonColumn>
                            </Columns>
                            <EditFormSettings>
                                <PopUpSettings ScrollBars="None" Width="200px" Height="200px"/>
                            </EditFormSettings>
                        </MasterTableView>
                        <HeaderStyle ForeColor="#336600" />
                    </telerik:RadGrid>
                    --%>
                </p>
                <p>
                    <asp:Button ID="AddDrawingButton" runat="server" Text="Add Drawing" UseSubmitBehavior="false"
                        ValidationGroup="ProductValidation" /> 
                </p>
                <telerik:RadToolTip ID="drawingsToolTip" runat="server" Skin="Default2006" ManualClose="True"
                    Position="Center" RelativeTo="Element" ShowEvent="FromCode" Animation="None"
                    ShowDelay="200" Title="Add a Drawing" Modal="True" BorderStyle="Solid" BorderWidth="1px"
                    Font-Bold="True" Font-Size="Medium" ForeColor="Blue">
                    <table cellspacing="7">
                        <tr>
                            <td valign="top" align="right" class="H2Internal">
                                Name:
                            </td>
                            <td>
                                <telerik:RadTextBox ID="DrawingTextBox" runat="server" EmptyMessage="Drawing Name"
                                    Skin="Vista" ValidationGroup="drawingValidation" EnableViewState="False" MaxLength="75">
                                    <EmptyMessageStyle Font-Italic="True" />
                                </telerik:RadTextBox>
                                 <cc1:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="DrawingTextBox"
                                    ErrorMessage="Drawing Name is Required." ValidationGroup="drawingValidation"
                                    CssClass="H3Internal"></cc1:RequiredFieldValidator
                                <spi:SPIValidator ID="SPIValidator3" runat="server" AllowPattern="[\s\x21-\x7E\xA0-\xFF]*"
                                    ControlToValidate="DrawingTextBox" Display="None" DenyPattern="All" ErrorMessage="*"
                                    MaxLength="75" ReplacePattern="$0" IgnoreCase="True" ValidationGroup="drawingValidation"></spi:SPIValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" valign="top" class="H2Internal">
                                Overview:
                            </td>
                            <td valign="top">
                                <asp:TextBox ID="DrawingOverviewTextBox" runat="server" Height="100px" TextMode="MultiLine"
                                    Width="250px" CssClass="H3Internal"></asp:TextBox><br />
                                <spi:SPIValidator ID="SPIValidator4" runat="server" AllowPattern="[\s\x21-\x7E\xA0-\xFF]*"
                                    ControlToValidate="DrawingOverviewTextBox" DenyPattern="All" Display="None" ErrorMessage="*"
                                    IgnoreCase="True" MaxLength="75" ReplacePattern="$0" ValidationGroup="drawingValidation"></spi:SPIValidator>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" class="H2Internal">
                                PDF File:
                            </td>
                            <td>
                                <telerik:RadUpload ID="DrawingPDFRadUpload" runat="server" ControlObjectsVisibility="ClearButtons"
                                    Skin="Vista" ReadOnlyFileInputs="True" AllowedFileExtensions=".pdf"></telerik:RadUpload>
                                <br />
                                <asp:CustomValidator ID="PDFCustomValidator" runat="server" ClientValidationFunction="validatePDFRadUpload"
                                    Display="Dynamic" ErrorMessage="Invalid file extension." CssClass="H3Internal"></asp:CustomValidator>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" class="H2Internal">
                                Parts Excel File:
                            </td>
                            <td>
                                <telerik:RadUpload ID="PartsRadUpload" runat="server" AllowedFileExtensions=".xls"
                                    ControlObjectsVisibility="ClearButtons" Skin="Vista" ReadOnlyFileInputs="True">
                                </telerik:RadUpload>
                                <br />
                                <asp:CustomValidator ID="PartsCustomValidator" runat="server" ClientValidationFunction="validatePartsRadUpload"
                                    Display="Dynamic" ErrorMessage="Invalid file extension." CssClass="H3Internal"></asp:CustomValidator>
                            </td>
                        </tr>
                    </table>
                    <asp:Button ID="SubmitDrawingButton" runat="server" Text="Submit" /></telerik:RadToolTip>
                <asp:SqlDataSource ID="drawingsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:orthmanConnectionString %>"
                    SelectCommand="getDrawings" SelectCommandType="StoredProcedure" InsertCommand="addDrawing"
                    InsertCommandType="StoredProcedure" DeleteCommandType="StoredProcedure" DeleteCommand="deleteDrawing">
                    <SelectParameters>
                        <asp:Parameter Name="ProductId" Type="Int32" DefaultValue="0" />
                    </SelectParameters>
                    <InsertParameters>
                        <asp:ControlParameter ControlID="DrawingTextBox" Name="Name" PropertyName="Text"
                            Type="String" />
                        <asp:ControlParameter ControlID="DrawingOverviewTextBox" Name="OverviewText" PropertyName="Text"
                            Type="String" />
                        <asp:Parameter DefaultValue="0" Name="productID" Type="Int16" />
                        <asp:Parameter Name="PathToPDF" Type="String" />
                        <asp:Parameter Name="sourceFile" Type="String" />
                    </InsertParameters>
                    <DeleteParameters>
                        <asp:QueryStringParameter Name="productId" QueryStringField="ID" Type="Int32" />
                    </DeleteParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" style="width: 82px">
            </td>
            <td style="width: 424px">
                <telerik:RadProgressManager ID="RadProgressManager1" runat="server" Skin="Vista" />
                <br />
                <telerik:RadProgressArea ID="RadProgressArea1" runat="server" DisplayCancelButton="True"
                    Skin="Vista">
                </telerik:RadProgressArea>
            </td>
        </tr>
        <tr>
            <td valign="top" align="right" style="width: 82px">
            </td>
            <td style="width: 424px">
                <asp:Button ID="AddButton" runat="server" Text="Add" ValidationGroup="ProductValidation" />
                <asp:Button ID="updateButton" runat="server" Text="Update" Visible="False" ValidationGroup="ProductValidation" />
                <asp:Button ID="cancelButton" runat="server" Text="Cancel" CausesValidation="False" />
            </td>
        </tr>
    </table>
    <asp:Label ID="msgLabel" runat="server"></asp:Label> <br />
    <br />
    <asp:SqlDataSource ID="CategoriesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:orthmanConnectionString %>"
        SelectCommand="getCategories" SelectCommandType="StoredProcedure" InsertCommand="addProduct"
        InsertCommandType="StoredProcedure" UpdateCommand="UpdateProduct" UpdateCommandType="StoredProcedure">
        <InsertParameters>
            <asp:Parameter DefaultValue="0" Name="CategoryId" Type="Int32" />
            <asp:ControlParameter ControlID="NameTextBox" DefaultValue="No Name!!" Name="Name"
                PropertyName="Text" Type="String" />
            <asp:Parameter DefaultValue="No Description Provided!!!" Name="Description" Type="String" />
            <asp:Parameter DefaultValue="" Name="PathToManual" Type="String" />
            <asp:Parameter DefaultValue="" Name="ImageURL" Type="String" />
            <asp:Parameter Direction="Output" Name="NewProductID" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:QueryStringParameter Name="ProductId" QueryStringField="ID" Type="Int32" />
            <asp:ControlParameter ControlID="NameTextBox" Name="Name" PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="descriptionTextBox" Name="Description" PropertyName="Text"
                Type="String" />
            <asp:Parameter DefaultValue="" Name="ImageURL" Type="String" />
            <asp:Parameter DefaultValue="" Name="PathToManual" Type="String" />
            <asp:Parameter DefaultValue="0" Name="CategoryId" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>


Imports System.Data.SqlClient
Imports Telerik.Web.UI
Imports Telerik.Web.UI.Upload
Imports System.IO
Imports System.Data.OleDb
Imports System.Data
 
Partial Public Class Product
    Inherits System.Web.UI.Page
    Shared parentID As Integer
    Shared productImg As String
    Shared productMan As String
    Shared productId As Integer = 0
    Shared pdfFileToDelete As String = ""
    Dim connString As String = System.Configuration.ConfigurationManager.ConnectionStrings("orthmanConnectionString").ToString
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
 
        If Not Page.IsPostBack Then
 
            If Not (String.IsNullOrEmpty(Request.QueryString("ID"))) Then
 
                'bind the grid
                bindDrawingsGrid()
                newDrawing.DataBind()
 
 
                'CategoriesSqlDataSource.DeleteParameters("productId").DefaultValue = Request.QueryString("ID")
 
 
                Integer.TryParse(Request.QueryString("ID"), productId)
                loadDrawings(productId)
                loadProduct()
                updateButtons()
                Me.ImagePanel.Visible = True
            Else
                productId = 0
                'CategoriesSqlDataSource.DeleteParameters("productId").DefaultValue = productId
                Me.ImagePanel.Visible = False
                Me.deleteManualButton.Visible = False
                Me.ManualHyperLink.Visible = False
            End If
        End If
    End Sub
 
    '*******************************************************************
    '2012-01-31 update by michael andrews the telerik drawings grid wasn't working
    'so I'm just creating a new one. this function binds the grid
    '*******************************************************************
    Protected Sub bindDrawingsGrid()
 
        'create the sql
        Dim sql = "SELECT R.DrawingId, R.ProductId, R.Name, R.PathToPDF FROM dbo.Drawings as R" & _
                  " WHERE R.ProductId = " & Request.QueryString("ID") & _
                  " order by R.Name"
 
        'create the datasource
        Dim dataSource = New SqlDataSource(connString, sql)
 
        newDrawing.DataSource = dataSource
 
 
    End Sub 'bindDrawingsGrid
 
    Protected Sub getNodeValue(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs)
        Integer.TryParse(e.Node.Value, parentID)
    End Sub
    Protected Sub selectFirstNode(ByVal sender As Object, ByVal e As System.EventArgs)
        If Not (String.IsNullOrEmpty(Request.QueryString("ID"))) Then
            Try
                Dim node As RadTreeNode = RadTreeView1.FindNodeByValue(getParentID())
                If node IsNot Nothing Then
                    node.Selected = True
                    Integer.TryParse(node.Value, parentID)
                    node.ExpandParentNodes()
                    
                End If
            Catch ex As Exception
                msgLabel.Text = ex.ToString
            End Try
        Else
            Me.RadTreeView1.Nodes(0).Selected = True
            Me.RadTreeView1.Nodes(0).Expanded = True
            Integer.TryParse(Me.RadTreeView1.Nodes(0).Value, parentID)
        End If
    End Sub
    Protected Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
        Page.Validate("ProductValidation")
        If Page.IsValid Then
            addProduct()
            Response.Redirect("default.aspx")
        End If
    End Sub
    Protected Sub AddProductDataSource_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles CategoriesSqlDataSource.Inserted
        Dim newProductID As Integer = Convert.ToInt32(e.Command.Parameters("@NewProductID").Value)
        productId = newProductID
    End Sub
    Protected Sub updateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updateButton.Click
        Page.Validate("ProductValidation")
        If Page.IsValid Then
            Me.CategoriesSqlDataSource.UpdateParameters("ImageURL").DefaultValue = productImg
 
            Dim productImageName As String
            Dim targetImageFolder As String = "~/admin/products/Documents/Images/"
            For Each validFile As UploadedFile In ImageRadUpload.UploadedFiles
                productImageName = "Imageproduct" & productId & validFile.GetExtension()
                validFile.SaveAs(Path.Combine(Server.MapPath(targetImageFolder), productImageName), True)
                Me.CategoriesSqlDataSource.UpdateParameters("ImageURL").DefaultValue = targetImageFolder & productImageName
            Next
 
            Me.CategoriesSqlDataSource.UpdateParameters("PathToManual").DefaultValue = productMan
 
            Dim productManualName As String
            Dim targetManualFolder As String = "~/admin/products/Documents/Manuals/"
            For Each validFile As UploadedFile In manualRadUpload.UploadedFiles
                productManualName = "Manualproduct" & productId & validFile.GetExtension()
                validFile.SaveAs(Path.Combine(Server.MapPath(targetManualFolder), productManualName), True)
                Me.CategoriesSqlDataSource.UpdateParameters("PathToManual").DefaultValue = targetManualFolder & productManualName
            Next
 
            Me.CategoriesSqlDataSource.UpdateParameters("Description").DefaultValue = Server.HtmlEncode(Me.descriptionTextBox.Text)
            Me.CategoriesSqlDataSource.UpdateParameters("CategoryId").DefaultValue = parentID
            Me.CategoriesSqlDataSource.Update()
 
            Response.Redirect("default.aspx")
        End If
    End Sub
    Protected Sub updateButtons()
        Me.AddButton.Visible = False
        Me.updateButton.Visible = True
    End Sub
    Protected Sub cancelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancelButton.Click
        Response.Redirect("default.aspx")
    End Sub
    Protected Sub loadProduct()
        Dim myConnection As New Data.SqlClient.SqlConnection(connString)
        Dim strSQL = "getProductById"
        Dim selectCommand As New Data.SqlClient.SqlCommand(strSQL, myConnection)
        Dim idParameter As New SqlClient.SqlParameter("@ProductId", SqlDbType.Int)
        Dim userReader As SqlDataReader
        Try
            selectCommand.CommandType = CommandType.StoredProcedure
            idParameter.Value = Request.QueryString("Id")
            selectCommand.Parameters.Add(idParameter)
            myConnection.Open()
            userReader = selectCommand.ExecuteReader()
            userReader.Read()
            Me.NameTextBox.Text = Server.HtmlDecode(userReader("Name"))
            Me.descriptionTextBox.Text = Server.HtmlDecode(userReader("Description"))
 
            If Not (IsDBNull(userReader("ImageURL"))) Then
                Me.ImagePanel.Visible = True
                Me.ProductImage.ImageUrl = userReader("ImageURL")
                productImg = userReader("ImageURL")
                Me.ImageUploadPanel.Visible = False
            Else
                Me.ImagePanel.Visible = False
                Me.ProductImage.Visible = False
                Me.deleteButton.Visible = False
            End If
 
            If Not (IsDBNull(userReader("PathToManual"))) Then
                Me.ManualHyperLink.Visible = True
                Me.ManualHyperLink.NavigateUrl = userReader("PathToManual")
                Me.ManualHyperLink.Text = "Manual"
                productMan = userReader("PathToManual")
                manualRadUpload.Visible = False
            Else
                Me.ManualHyperLink.Visible = False
                Me.deleteManualButton.Visible = False
                Me.manualRadUpload.Visible = True
            End If
 
            userReader.Close()
        Catch ex As Exception
            Me.msgLabel.Text = ex.ToString
        Finally
            myConnection.Close()
        End Try
    End Sub
    Protected Sub deleteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles deleteButton.Click
        Try
            orthman.deleteImageFromProduct(Request.QueryString("ID"))
            File.Delete(Server.MapPath(Me.ProductImage.ImageUrl))
            Me.ProductImage.ImageUrl = ""
            productImg = ""
            Me.ImageUploadPanel.Visible = True
            Me.ImagePanel.Visible = False
        Catch ex As Exception
            msgLabel.Text = ex.ToString
        End Try
    End Sub
    Protected Function getParentID() As String
        Dim myParentID As String = "0"
        Dim myConnection As New Data.SqlClient.SqlConnection(connString)
        Dim strSQL = "getProductById"
        Dim selectCommand As New Data.SqlClient.SqlCommand(strSQL, myConnection)
        Dim idParameter As New SqlClient.SqlParameter("@ProductId", SqlDbType.Int)
        Dim userReader As SqlDataReader
        Try
            selectCommand.CommandType = CommandType.StoredProcedure
            idParameter.Value = Request.QueryString("Id")
            selectCommand.Parameters.Add(idParameter)
            myConnection.Open()
            userReader = selectCommand.ExecuteReader()
            userReader.Read()
            myParentID = userReader("CategoryId")
            userReader.Close()
        Catch ex As Exception
            Me.msgLabel.Text = ex.ToString
        Finally
            myConnection.Close()
        End Try
        Return myParentID
    End Function
    Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles deleteManualButton.Click
        Try
            orthman.deleteManualFromProduct(Request.QueryString("ID"))
            File.Delete(Server.MapPath(Me.ManualHyperLink.NavigateUrl))
            Me.ManualHyperLink.NavigateUrl = ""
            productMan = ""
            Me.manualRadUpload.Visible = True
            Me.ManualHyperLink.Visible = False
            Me.deleteManualButton.Visible = False
        Catch ex As Exception
 
        End Try
    End Sub
    Protected Sub loadDrawings(ByVal productId As Integer)
        'Me.drawingsSqlDataSource.SelectParameters("ProductId").DefaultValue = productId
 
        'Me.drawingsSqlDataSource.DeleteParameters("ProductId").DefaultValue = productId
        'Me.drawingsSqlDataSource.DataBind()
    End Sub
    Protected Sub AddDrawingButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddDrawingButton.Click
        Page.Validate("ProductValidation")
        If Page.IsValid Then
 
            If productId = 0 Then
                addProduct()
                loadDrawings(productId)
                Me.drawingsToolTip.Visible = True
                Me.drawingsToolTip.Show()
                Me.AddButton.Visible = False
                Me.updateButton.Visible = True
            Else
                Me.drawingsToolTip.Visible = True
                Me.drawingsToolTip.Show()
            End If
        End If
    End Sub
    Protected Sub SubmitDrawingButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubmitDrawingButton.Click
 
        Page.Validate("drawingValidation")
        If Page.IsValid Then
            Dim pdfPath
            For Each validFile As UploadedFile In DrawingPDFRadUpload.UploadedFiles
                Dim targetFolder As String = Server.MapPath("~/admin/products/Documents/Drawings/")
                validFile.SaveAs(Path.Combine(targetFolder, "DrawingProduct" & productId & validFile.GetName()), True)
                pdfPath = "/admin/products/Documents/Drawings/" & "DrawingProduct" & productId & validFile.GetName()
                'Me.drawingsSqlDataSource.InsertParameters("PathToPDF").DefaultValue = "~/admin/products/Documents/Drawings/" & "DrawingProduct" & productId & validFile.GetName()
 
            Next
            For Each validFile As UploadedFile In PartsRadUpload.UploadedFiles
                Try
 
                    '*********************************************************
                    '2012-02-10 edit by michael andrews
                    'we moved servers and the DB server couldn't access the file on the web
                    'server so I rebuilt this code THE WAY IT FUCKING SHOULD HAVE BEEN WRITTEN
                    '*********************************************************
 
                    Dim targetFolder As String = Server.MapPath("~/admin/Temp/")
 
                    validFile.SaveAs(Path.Combine(targetFolder, "XLSProduct" & productId & validFile.GetName()), True)
 
                    Dim filePath = Path.Combine(targetFolder, "XLSProduct" & productId & validFile.GetName())
                    'Me.drawingsSqlDataSource.InsertParameters("sourceFile").DefaultValue = filePath
 
 
 
                    'first we have to insert to get the batch id
                    Dim conn As New SqlConnection(connString)
                    Dim sql = "addDrawingFirst"
                    conn.Open()
                    Dim cmd As New SqlCommand(sql, conn)
                    cmd.CommandType = CommandType.StoredProcedure
                    cmd.Parameters.AddWithValue("@productId", Request.QueryString("ID"))
                    cmd.Parameters.AddWithValue("@Name", DrawingTextBox.Text)
                    cmd.Parameters.AddWithValue("@PathToPDF", pdfPath)
                    cmd.Parameters.AddWithValue("@OverviewText", DrawingOverviewTextBox.Text)
                    cmd.Parameters.AddWithValue("@sourceFile", filePath)
                    cmd.Parameters.Add("@batchid", SqlDbType.Int).Direction = ParameterDirection.Output
                    cmd.Parameters.Add("@drawingId", SqlDbType.Int).Direction = ParameterDirection.Output
 
                    cmd.ExecuteNonQuery()
                    conn.Close()
                    Dim returnVal As String = cmd.Parameters("@batchid").Value.ToString()
                    Dim drawingId As String = cmd.Parameters("@drawingId").Value.ToString()
 
 
                    Dim xlsConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";"
 
                    Dim mytable As New DataTable
                    mytable.Columns.Add("Key")
                    mytable.Columns.Add("partKeyAlpha")
                    mytable.Columns.Add("Part #")
                    mytable.Columns.Add("Description")
                    mytable.Columns.Add("Comments")
                    mytable.Columns.Add("Not Available")
                    mytable.Columns.Add("batchId")
 
                    Using myconn As New OleDbConnection(xlsConnString)
                        myconn.Open()
                        'get the file
                        sql = "SELECT [Key], [partKeyAlpha], [Part #], [Description], [Comments], " & _
                        "[Not Available] FROM [Sheet1$] WHERE [Key] IS NOT NULL OR [Part #] IS NOT NULL OR " & _
                        "[Description] IS NOT NULL"
 
                        'partKey, partKeyNumeric, partKeyAlpha, PartNumber, [Description], Comment, notAvailable ,BatchID
 
                        Dim excelCmd As New OleDbCommand(sql, myconn)
                        Dim excelReader As OleDbDataReader = excelCmd.ExecuteReader()
                        While excelReader.Read()
                            mytable.Rows.Add(excelReader("Key"), excelReader("partKeyAlpha"), excelReader("Part #"), _
                                             excelReader("Description"), excelReader("Comments"), excelReader("Not Available"), _
                                             returnVal)
                        End While
 
 
                        myconn.Close()
                    End Using
 
 
 
                    ''now bulk insert the data
                    'Using bulkCopy As New SqlBulkCopy(connString)
                    '    bulkCopy.DestinationTableName = "tempParts"
                    '    bulkCopy.ColumnMappings.Add("Key", "partKey")
                    '    bulkCopy.ColumnMappings.Add("Key", "partKeyNumeric")
                    '    bulkCopy.ColumnMappings.Add("partKeyAlpha", "partKeyAlpha")
                    '    bulkCopy.ColumnMappings.Add("Part #", "PartNumber")
                    '    bulkCopy.ColumnMappings.Add("Description", "Description")
                    '    bulkCopy.ColumnMappings.Add("Comments", "Comment")
                    '    bulkCopy.ColumnMappings.Add("Not Available", "notAvailable")
                    '    bulkCopy.ColumnMappings.Add("batchId", "batchId")
                    '    bulkCopy.WriteToServer(mytable)
                    'End Using
 
                    sql = "INSERT INTO tempParts([partKey], [partKeyNumeric], [partKeyAlpha], [PartNumber], [Description], " & _
                        "[Comment], [notAvailable], [batchId]) "
 
                    For Each j As DataRow In mytable.Rows
 
                        sql &= vbCrLf & "SELECT '" & j("key") & "', '" & j("key") & "', '" & j("partKeyAlpha") & "', '" & _
                            j("Part #") & "', '" & j("Description") & "', '" & j("Comments") & "', '" & j("Not Available") & _
                            "', " & j("batchId") & vbCrLf & " UNION ALL"
 
                        'Response.Write(j("Key") & ", " & j("partKeyAlpha") & ", " & j("Part #") & ", " & j("Description") & _
                        '               ", " & j("Comments") & ", " & j("Not Available") & ", " & _
                        '               j("batchId") & "<br />")
                    Next
 
                    sql = sql.substring(0, sql.length - 9) & " GO"
 
 
                    'Response.Write(sql)
 
                    'Exit Sub
 
                    'insert into temp parts
                    Using newconn As New SqlConnection(connString)
                        newconn.Open()
                        Dim insertCmd As New SqlCommand(sql, newconn)
                        insertCmd.ExecuteNonQuery()
                        newconn.Close()
                    End Using 'using newconn
 
 
                    sql = "addDrawingSecond"
                    conn.Open()
                    cmd = New SqlCommand(sql, conn)
                    cmd.CommandType = CommandType.StoredProcedure
                    cmd.Parameters.AddWithValue("@productId", Request.QueryString("ID"))
                    cmd.Parameters.AddWithValue("@drawingId", drawingId)
                    cmd.ExecuteNonQuery()
                    conn.Close()
 
                Catch ex As Exception
                    Response.Write(ex.ToString)
                End Try
 
            Next
            'Me.drawingsSqlDataSource.InsertParameters("productId").DefaultValue = productId
            'Try
            '    'Me.drawingsSqlDataSource.Insert()
            'Catch ex As Exception
            '    Response.Write("<br />" & ex.ToString)
            'End Try
 
            '*********************************************************
            'end edit
            '*********************************************************
 
 
            Me.AddButton.Visible = False
            Me.updateButton.Visible = True
            Me.drawingsToolTip.Visible = False
        End If
    End Sub
    Protected Sub addProduct()
        Dim productImageName As String
        Dim targetImageFolder As String = "~/admin/products/Documents/Images/"
        For Each validFile As UploadedFile In ImageRadUpload.UploadedFiles
            productImageName = "Imageproduct" & orthman.findNextProductID() & validFile.GetExtension()
            validFile.SaveAs(Path.Combine(Server.MapPath(targetImageFolder), productImageName), True)
            Me.CategoriesSqlDataSource.InsertParameters("ImageURL").DefaultValue = targetImageFolder & productImageName
 
        Next
 
        Dim productManualName As String
        Dim targetManualFolder As String = "~/admin/products/Documents/Manuals/"
        For Each validFile As UploadedFile In manualRadUpload.UploadedFiles
            productManualName = "Manualproduct" & orthman.findNextProductID() & validFile.GetExtension()
            validFile.SaveAs(Path.Combine(Server.MapPath(targetManualFolder), productManualName), True)
            Me.CategoriesSqlDataSource.InsertParameters("PathToManual").DefaultValue = targetManualFolder & productManualName
        Next
 
        Me.CategoriesSqlDataSource.InsertParameters("Description").DefaultValue = Server.HtmlEncode(Me.descriptionTextBox.Text)
        Me.CategoriesSqlDataSource.InsertParameters("CategoryId").DefaultValue = parentID
        Me.CategoriesSqlDataSource.Insert()
    End Sub
     
 
    '*********************************************************
    'update by michael andrews 2012-01-09 to fix a delete issue
    'I ended up jsut removing the telerik rad grid and replacing
    'it with a new one
    '*********************************************************
    Private Sub newDrawing_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles newDrawing.ItemCommand
 
        Dim drawingId = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("drawingId")
        Dim sql = "SELECT name, pathtopdf FROM Drawings WHERE drawingId = " & drawingId
        Dim myconn As New SqlConnection(connString)
        myconn.Open()
        Dim cmd As New SqlCommand(sql, myconn)
        Dim reader = cmd.ExecuteReader()
        Dim pdfPath, name As String
 
 
        While reader.Read()
 
            name = reader("name")
            pdfPath = reader("pathToPdf").ToString
 
        End While 'while reader.read
        reader.Close()
 
        'delete the file
        If Not String.IsNullOrEmpty(pdfPath) Then
            'call the sp to remove it
            sql = "deleteDrawing"
            cmd = New SqlCommand(sql, myconn)
            cmd.CommandType = CommandType.StoredProcedure
 
            cmd.Parameters.AddWithValue("@productId", Request.QueryString("ID"))
            cmd.Parameters.AddWithValue("@drawingId", drawingId)
            cmd.Parameters.AddWithValue("@pathToPDF", pdfPath)
 
            cmd.ExecuteNonQuery()
 
            File.Delete(Server.MapPath(pdfPath))
        End If 'if not string
 
        myconn.Close()
        myconn.Dispose()
 
        newDrawing.Rebind()
 
    End Sub
 
    Private Sub newDrawing_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles newDrawing.NeedDataSource
        bindDrawingsGrid()
    End Sub
 
    ''removing old code
    'Sub On_Record_Deleted(ByVal source As Object, ByVal e As SqlDataSourceStatusEventArgs)
    '    If (e.AffectedRows > 0) Then
 
    '        If Not String.IsNullOrEmpty(pdfFileToDelete) Then
    '            Try
    '                File.Delete(Server.MapPath(pdfFileToDelete))
    '            Catch ex As Exception
    '                msgLabel.Text = ex.ToString
 
    '            End Try
    '        End If
    '    End If
    'End Sub
    'Protected Sub deletingDrawing(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles drawingsGrid.DeleteCommand
    '    Dim index As Integer
    '    index = e.Item.ItemIndex
    '    If Not (String.IsNullOrEmpty(Me.drawingsGrid.Items(index).GetDataKeyValue("pathToPDF"))) Then
    '        pdfFileToDelete = Me.drawingsGrid.Items(index).GetDataKeyValue("pathToPDF")
    '    End If
    'End Sub
 
    '****************************************************************
    'end edit
    '****************************************************************
 
 
End Class






0
Maria Ilieva
Telerik team
answered on 29 Feb 2012, 01:51 PM
Hello,

tested the provided online url but wa snot able to replicate the described error on my end eve trying different scenarios. Could you please elaborate a bit more on the exact steps which should be used in order to replicate the problematic behaviour

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 29 Feb 2012, 03:26 PM
Essentially, I have a rad ajax panel, 2 rad uploads, a radgrid, and a radtooltip with some rad crontrols in them. Using the version of the controls I am, you get that error on win xp machines. That url works fine for me. Did the site come up at all for you? If so, did you use the username testuser and the password and the password t3st@dm1n? I can provide a link to download my project with a backup of the db to an email if you want.
0
Maria Ilieva
Telerik team
answered on 05 Mar 2012, 10:15 AM
Hello,

I'm able to login to your site using the provided credentials however I'm not able to replicate the mentioned error after trying several different steps for that. Could you please let me know what are the exact steps I should follow so the error to appear.

Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Web Services
Top achievements
Rank 2
answered on 05 Mar 2012, 04:58 PM
You have to go to that page and click the add drawing button. Note that the machine needs to be windows xp and you need to be using IE. Here is a link to a video of the issue. http://dl.dropbox.com/u/4979877/error.swf
0
Iana Tsolova
Telerik team
answered on 19 Mar 2012, 11:51 AM
Hi,

I watched the video and I can see it shows the same error as illustrated in the screenshot from your first post.
To solve it, you need to register the handlers for RadUpload as suggested from my colleague Maria.

If afterwards other errors come up, you need to work on resolving them as well. Reviewing the conversation I can see you where receiving two server-side errors (NullReferenceException: Object reference not set to an instance of an object). You should be able to easily locate and resolve them if you run the page in debug mode, with F5. If you can share the method and specify on which line the error is thrown, we might be able to help you finding a solution.

Regards,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Web Services
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Web Services
Top achievements
Rank 2
Iana Tsolova
Telerik team
Share this question
or