I looked at your sample - whatever it is that allows yours to work and mine to fail is too subtle for me. Since there is no obvious way to attach my code, I have pasted below.
Appreciate the help,
Andy
/********************** AdminForm.aspx *****************************/
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdminForm.aspx.cs" Inherits="AdminApp.AdminForm" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"MasterScriptManager"
runat
=
"server"
EnablePageMethods
=
"true"
/>
<
telerik:RadFormDecorator
ID
=
"FormDecorator1"
runat
=
"server"
DecoratedControls
=
"All"
>
</
telerik:RadFormDecorator
>
<
fieldset
id
=
"importSmpTable"
>
<
div
class
=
"formCol"
>
<
br
/>
You may configure a user with primary responsibility for the imported project. You
may also assign the project to an OBS node. Note that if you assign the project
to another user AND an OBS mode to which you have no access, the project will not
be visible to you after import.
<
h5
>
Associated OBS Node</
h5
>
<
br
/>
<
telerik:RadComboBox
ID
=
"ddlObs"
runat
=
"server"
Width
=
"85%"
ShowToggleImage
=
"True"
ToolTip
=
"Select a node from the Organization Breakdown Structure."
Style
=
"vertical-align: middle;"
OnClientDropDownOpened
=
"OnClientDropDownOpenedHandler"
EmptyMessage
=
"Choose an OBS node"
ExpandAnimation-Type
=
"None"
CollapseAnimation-Type
=
"None"
>
<
ItemTemplate
>
<
div
id
=
"div1"
>
<
telerik:RadTreeView
runat
=
"server"
ID
=
"treeviewObs"
OnClientNodeClicking
=
"nodeClicking"
Width
=
"100%"
Height
=
"140px"
>
</
telerik:RadTreeView
>
</
div
>
</
ItemTemplate
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadButton
ID
=
"btnClearObs"
runat
=
"server"
Text
=
""
OnClientClicked
=
"btnClearObs_Click"
ToolTip
=
"Clear Associated OBS setting"
>
<
Icon
PrimaryIconCssClass
=
"rbRemove"
PrimaryIconLeft
=
"4"
PrimaryIconTop
=
"4"
/>
</
telerik:RadButton
>
<
br
/>
<
asp:CheckBox
ID
=
"chkHigherNodes"
runat
=
"server"
Text
=
"Grant access to nodes higher than the selected OBS node."
Checked
=
"true"
/>
<
br
/>
<
br
/>
<
br
/>
<
h5
>
<
asp:Label
ID
=
"lblPrimaryResponsibility"
runat
=
"server"
AssociatedControlID
=
"ddlPrimaryResponsibility"
Text
=
"Assign primary responsibility"
/>
</
h5
>
<
br
/>
<
div
>
<
telerik:RadComboBox
ID
=
"ddlPrimaryResponsibility"
runat
=
"server"
Width
=
"80%"
ToolTip
=
"Select a user to have the primary responsibility for this estimation project."
/>
</
div
>
<
br
/>
<
br
/>
</
div
>
<
div
class
=
"formCol"
style
=
"padding-right: 10px;"
>
<
h5
>
<
asp:Label
ID
=
"lblSelect"
runat
=
"server"
Text
=
"Select source (SEW Workbook)"
/>
</
h5
>
<
div
class
=
"upload-panel"
>
<
h6
>
1. Select .SEW file to import:</
h6
>
<
telerik:RadAsyncUpload
ID
=
"UploadControl"
runat
=
"server"
MaxFileInputsCount
=
"1"
AllowedFileExtensions
=
"sew"
PostbackTriggers
=
"ImportButton"
/>
<%----%>
</
div
>
<
telerik:RadProgressManager
ID
=
"RadProgressManager1"
runat
=
"server"
/>
<
h6
>
2. After file upload is complete, click button below to complete the import process:</
h6
>
<
br
/>
<
telerik:RadButton
ID
=
"ImportButton"
runat
=
"server"
Text
=
"Import SLIM-Estimate Project"
OnClick
=
"OnImport"
/>
<
br
/>
<
br
/>
<
br
/>
<
p
>
<
asp:Label
ID
=
"Notification"
runat
=
"server"
CssClass
=
"failureNotification boldError"
/></
p
>
</
div
>
<
script
type
=
"text/javascript"
>
var isError = <%=IsError.ToString().ToLower()%>;
var errorMessage = "<%=ErrorMessage%>";
if(isError)
{
alert(errorMessage);
}
function btnClearObs_Click( sender, eventArgs )
{
var ddl = $find( "<%= ddlObs.ClientID %>" );
ddl.set_text( "" );
ddl.trackChanges();
ddl.get_items().getItem( 0 ).set_text( "" );
ddl.commitChanges();
var tree = ddl.get_items().getItem( 0 ).findControl( "treeviewObs" );
var selectedNode = tree.get_selectedNode();
if ( selectedNode != null )
selectedNode.set_selected( false );
}
function nodeClicking( sender, args )
{
var comboBox = $find( "<%= ddlObs.ClientID %>" );
var node = args.get_node();
comboBox.set_text( node.get_text() );
comboBox.trackChanges();
comboBox.get_items().getItem( 0 ).set_text( node.get_text() );
comboBox.commitChanges();
comboBox.hideDropDown();
}
//find the selected node in the treeview inside the combobox and scroll it into view
function OnClientDropDownOpenedHandler( sender, eventArgs )
{
var tree = sender.get_items().getItem( 0 ).findControl( "rtvObs" );
var selectedNode = tree.get_selectedNode();
if ( selectedNode )
{
selectedNode.scrollIntoView();
}
}
</
script
>
</
fieldset
>
</
form
>
</
body
>
</
html
>
/*************************************** AdminForm.aspx.cs ****************************************************/
using System;
using System.Configuration;
using System.Linq;
using Telerik.Web.UI;
using System.Web;
namespace AdminApp
{
public partial class AdminForm : System.Web.UI.Page
{
#region Error related
public bool IsError = false;
public string ErrorMessage = string.Empty;
protected void SetError( string message )
{
this.Notification.Text = message;
}
#endregion
protected void Page_Load( object sender, EventArgs e )
{
}
protected void OnImport( object sender, EventArgs e )
{
Page.Validate(); // perform server side validation
if ( !Page.IsValid )
return;
//string allowedExtension = (string)UploadControl.AllowedFileExtensions.GetValue( 0 );
if ( UploadControl.UploadedFiles.Count != 1 )
{
SetError( "Please select a single valid .sew workbook." );
return; // throw new InvalidOperationException( "Uploaded file count should always be '1'." );
}
string clientFile = UploadControl.UploadedFiles[ 0 ].FileName;
string fileExtension = System.IO.Path.GetExtension( clientFile ).ToLower();
if ( fileExtension != ".sew" )
{
SetError( "Incorrect file type. Please select an SEW file." );
return;
}
//remember the original source name; that will be the default name of the template
string sourceFile = System.IO.Path.GetFileNameWithoutExtension( clientFile );
// We're going to reset the file name to a GUID with .mdb
// as the extension. We're just opening it as
// an Access database. This will avoid the unlikely pos-
// sibility of two people trying to upload the same file
// at the same time and getting a file clash.
string fileName = string.Format( "{0}.mdb", Guid.NewGuid() );
// If there's an upload folder configured in the config file,
// use it. Otherwise, use a temp folder at the app root.
string uploadPath = ConfigurationManager.AppSettings[ "UploadDirectory" ];
if ( string.IsNullOrWhiteSpace( uploadPath ) )
{
uploadPath = "~/temp";
}
string filePath = System.IO.Path.Combine( HttpContext.Current.Server.MapPath( uploadPath ), fileName );
// This triggers the RadUpload control.
UploadControl.UploadedFiles[ 0 ].SaveAs( filePath );
string owner = ddlPrimaryResponsibility.SelectedValue;
int ownerId = 0;
if ( !string.IsNullOrWhiteSpace( owner ) && int.TryParse( owner, out ownerId ) )
ownerId = Convert.ToInt32( owner );
//retrieve project access selections
RadTreeView tree = ddlObs.Items[ 0 ].FindControl( "treeviewObs" ) as RadTreeView;
RadTreeNode selNode = tree.SelectedNode;
int? obsNodeId = selNode == null ? (int?)null : Convert.ToInt32( selNode.Value );
if ( !obsNodeId.HasValue && ownerId == 0 )
{
// no one has been assigned to access this project!
SetError( "You must assign either an OBS node or a person of primary responsibility." );
return;
}
System.IO.File.Delete( filePath );
}
}
}