Object not set to instance of object in Azure Emulator Model View - model-view-controller

I have an exception caused by a direct copy of another code which follows:
Controller:
public PartialViewResult Pictures()
{
picturesList.Clear();
CloudTable table = _Service.GetCloudTable();
CloudBlobContainer blob = _Service.GetCloudBlobContainer();
TableQuery<PictureEntity> query = new TableQuery<PictureEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "hiltihaningepictures"));
foreach (PictureEntity pic in table.ExecuteQuery(query))
{
picturesList.Add(pic);
}
picturesList.Sort();
return PartialView();
}
View:
#model List<WebRole.Models.PictureEntity>
<script type="text/javascript" src="~/Scripts/jquery.liquid-slider.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.touchSwipe.min.js"></script>
<script type="text/javascript">
$(function () {
$('#main-slider').liquidSlider({
height: '525px',
minHeight: '525px',
dynamicArrows: true,
dynamicArrowsGraphical: true,
autoHeight: false,
continuous: true,
autoSlide: true,
pauseOnHover: true
});
});
/* If you need to access the internal property or methods, use this:
var api = $.data( $('#slider-id')[0], 'liquidSlider');
*/
</script>
<div id="main_liquid" style="display: none;">
#foreach (var item in Model)
{
<div class="liquid-slider" id="main-slider">
<div>
<img src="#item.Url" class="intro_img_group" />
<p>Uppladdad av: #item.Uploader, #item.Timestamp.DateTime</p>
<p>Beskrivning: #item.Description</p>
</div>
</div>
}
The only difference is that the other view, which work just fine and dandy, doesn't contain the Javascript section. Other than that completely identical.
Exception details:
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=App_Web_v2igssw5
StackTrace:
at ASP._Page_Views_Home_Pictures_cshtml.Execute() in g:\HiltiHaninge\HiltiHaninge\Views\Home\Pictures.cshtml:line 23
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
It's recommendening me to use keyword new but I dont' know what to do

Related

asp.net mvc + Ajax.BeginForm OnBegin not firing

After reading several posts regarding this issue, it is mostly related to including
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
and the proper order of including jquery first.
<script src="~/Scripts/jquery-1.12.4.js"></script>
I think I did properly, but OnBegin is not firing still.
_Layout.cshtml:
<head>
<meta charset="utf-8" />
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<title>Test</title>
#Scripts.Render("~/bundles/modernizr")
<script src="~/Scripts/jquery-1.12.4.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<script src="~/Scripts/respond.min.js"></script>
<script src="~/Scripts/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/responsive/2.1.0/js/dataTables.responsive.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/buttons.colVis.min.js"></script>
<script src="~/Scripts/light-bootstrap-dashboard.js"></script>
<script src="~/Scripts/bootstrap-notify.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
#RenderSection("scripts", required: false)
</head>
So the order of process is:
School View:
#model Test.Models.School
<div class="editorRow">
#using (Html.BeginCollectionItem("schools"))
{
#Html.ActionLink("New Employee", "NewEmployee", "Test", new
{
#class = "btn btn-info btn-md",
data_toggle = "modal",
data_target = "#modal-container-employee"
})
</div>
<div id="modal-container-employee" class="modal fade" tableindex="-1" role="dialog">
<div class="modal-content">
<div class="modal-body">
</div>
</div>
</div>
Controller:
public ActionResult NewEmployee()
{
var newEmployee = new Employee();
return View(newEmployee);
}
Employee view:
#model Test.Models.Employee
#{
Layout = null;
}
#using (Ajax.BeginForm("PostEmployee", "Employee", new AjaxOptions
{
HttpMethod = "post",
InsertionMode = InsertionMode.Replace,
OnBegin = "closeModal"
}))
{
#Html.AntiForgeryToken()
<div id="test" class="">
<div class="modal-title title">
<input type="submit" id="submit" value="Save" /><span id="closes">x</span>
</div>
#Html.EditorFor(model => model.FullName)
</div>
}
<script>
function closeModal() {
$('#modal-container').modal('hide');
}
</script>
controller:
[HttpPost]
public ActionResult PostEmployee(Employee model)
{
try
{
var newEmployee = new Employee
{
FullName = model.FullName
};
db.Employees.Add(newEmployee);
db.SaveChanges();
return Json(new { status = "success" }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new { status = "error", errorMessage = ex.Message }, JsonRequestBehavior.AllowGet);
}
}
As a result, "success" Json is returned, but ajax is not catching it, it directly goes to the other page where it shows JSON array {"status":"success"}.
Can anyone find the problem?

('#Window').data('tWindow').close()

I have a telerik popped up window. It opens fine; however, I am having an issue closing the window. If I add an alert to the javascript, alert("#Window") or alert($(this).closest('#Window')), it will display [object Object]. However, alter("#Window").data("tWindow") or alert($(this).closest('#Window').data('tWindow')) will display null. I've removed the jquery and javascript reference from either the parent or the child page, and it did not make any difference. Any kind of help would be greatly appreciated. See sample code below
Here is the popup window:
#{Html.Telerik().Window()
.Name("Window")
.Title("Student Window")
.LoadContentFrom(Url.Action("AddReason", "Reason", new { id = reasonID }, Request.Url.Scheme))
.ClientEvents(events => events
.OnClose("ClosingWindow")
)
.Draggable(false)
.Scrollable(false)
.Width(800)
.Height(600)
.Modal(true)
.Visible(false)
//.Effects(fx => fx
// .Zoom()
// .Opacity())
.Render();
}
Here is the JavaScript:
<script src="#Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript">
</script>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/spin.min.js")" type="text/javascript"></script>
function DoOpen(id) {
var url = '#Url.Action("AddReason","Reason")';
$.post(url, { id: id }, function (data) {
var window = $('#Window').data('tWindow').center();
window.content(data);
window.open();
});
}
//This javascript is in the main page
//I did an alert. alert($('#Window')) and
alert($('#Window').data('tWindow')) they both return null
function ClosingWindow() {
$('#Window').prop("checked", "checked");
$('#Window').data('tWindow').close();
window.location.href = window.location.href;
}
Here is the partial view :
#model Student.Models.Reason
#using Student.Example
#{
ViewBag.Title = "Add Reason";
Layout = "~/Views/Shared/_PartialReason.cshtml";
}
<script type="text/javascript">
function CloseWindow() {
// alert($("#Window").closest('.t-window').data('#tWindow'));
// $("#Window").data("tWindow").close();
$('#Window').prop("checked", "checked");
window.location.href = window.location.href;
}
</script>
#using (Html.BeginForm("AddReason", "Reason", FormMethod.Post))
{
#Html.ValidationSummary(true)
<fieldset>
<div class="editor-field">
#(Html.Telerik().Editor()
.Name("EncountersArchive")
.HtmlAttributes(new { style = "height:310px;", id = "AddAReason" })
.Encode(true)
.Tools(
tools => tools
.Clear()
.Bold().Italic().Underline().Strikethrough().Subscript().Superscript().Separator()
.FontName().FontSize()
.FontColor().BackColor().Separator()
.JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().Separator()
.InsertUnorderedList().InsertOrderedList().Separator()
.Indent().Outdent().Separator()
))
</div>
<p style="text-align:center">
<input type="submit" value="Reason" id="AddReasonID" onclick="CloseWindow()"/>
</p>
</fieldset>
}
The OnClose event on the popup window was causing the issue. The onclose events should only be used if the user wished to do someonthing else after the window is closed. If the purpose is simply to close the window, the Telerik control is automatically handling it. In my case, I simply remove the onclose event, and it works like a charm.

MVC3 Ajax Ajax.ActionLink in Views Shared _Layout.cshtml

I have an mvc3 web app I used a shared view under
Views
Shared_Layout.cshtml
_Layout.cshtml contains markups which acts like a master page for our app
#using .............
#using ......
<!DOCTYPE html>
<html style="overflow: hidden">
<head>
<title>#ViewBag.Title</title>
<link href="#Url.Content("~/Content/Site.min.css")" rel="stylesheet" type="text/css" />
<link href="#Url.Content("~/Content/themes/metro-light/jquery-ui-1.8.16.custom.css")" rel="stylesheet" type="text/css" />
#RenderSection("CSS", false)
<script src="#Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"> </script>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"> </script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"> </script>
<script src="#Url.Content("~/Scripts/jquery-ui-1.8.16.custom.min.js")" type="text/javascript"> </script>
<script src="#Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"> </script>
...... (some other scripts here)
......
</head>
<body style="height: 100%">
<!-- page -->
<div class="page">
<div id="header">
<div id="title">
<img alt="" src="#Url.Content("~/Content/images/Logo.png")"/>#ViewBag.ApplicationName
</div>
<div id="logindisplay">
Welcome <strong>#User.Identity.Name</strong>
</div>
<ul id="menu">
<li>#Ajax.ActionLink("Dashboard", "Index","Dashboard", new {#class = "Map View".Equals(ViewBag.Title) ? "selected" : null},new AjaxOptions { UpdateTargetId = "main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" })</li>
<li>#Ajax.ActionLink("Map View", "Index", "Map", new { #class = "Map View".Equals(ViewBag.Title) ? "selected" : null },new AjaxOptions { UpdateTargetId = "main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" })</li>
<li>#Ajax.ActionLink("Settings", "Index", "Settings", new { #class = "Settings".Equals(ViewBag.Title) ? "selected" : null }, new AjaxOptions { UpdateTargetId = "main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" })</li>
<li>#Ajax.ActionLink("About", "Index", "AppInfo", new { #class = "About".Equals(ViewBag.Title) ? "selected" : null }, new AjaxOptions { UpdateTargetId = "main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" })</li>
</ul>
</div>
<div id="main">
#RenderBody()
</div>
</div>
<!-- footer -->
<div id="footer">
</div>
<form id="__ajaxAntiForgeryForm" action="#" method="post">#Html.AntiForgeryToken()</form>
</body>
</html>
Basically, from the above code I am replacing my "main" div with whatever the controller return
new AjaxOptions { UpdateTargetId = "main", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" }
Here are my controllers (nothing special)
DashboardController
[UiException]
public ActionResult Index()
{
return View();
}
MapController
[UiExceptionAttribute]
public ActionResult Index()
{
return View();
}
When I load the page and click on the links "Dashboard" or "Map View", the whole page flickers and refresh. Supposed to be #Ajax.ActionLink does not refresh the whole page but instead just the "main" div. Is there a way to have an ajax like behavior refreshing only the content section? Can anybody help? Thanks!
it is because you are returning the whole view from controller code which includes the whole masterpage(i.e. ur layout).
You need to render only partial view of your dashboard or map.
like:
DashboardController
[UiException]
public ActionResult Index()
{
return PartialView("yourviewname",model)
}
protected string RenderPartialViewToString(string viewName, object model)
{
if (string.IsNullOrEmpty(viewName))
viewName = ControllerContext.RouteData.GetRequiredString("action");
ViewData.Model = model;
using (StringWriter sw = new StringWriter())
{
ViewEngineResult viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName);
ViewContext viewContext = new ViewContext(ControllerContext, viewResult.View, ViewData, TempData, sw);
viewResult.View.Render(viewContext, sw);
return sw.GetStringBuilder().ToString();
}
}
Your unobtrusive Javascript include is missing so the action links are actually no "real" ajax links because no event handler have been attached to it (the unobtrusive-ajax script basically looks for all links with attribute data-ajax=true and attaches methods to it to do the ajax stuff).
So include the jquery.unobtrusive-ajax.min.js file as well and it should work as expected.
as above i found this useful too.. without putting the View on the _Shared folder.
/// <summary>
/// Dynamically Render a View using the passed-in context
/// </summary>
/// <param name="controllerContext"></param>
/// <param name="viewName"></param>
/// <param name="model"></param>
/// <returns></returns>
public static string RenderView(ControllerContext controllerContext, string viewName, object model)
{
controllerContext.Controller.ViewData.Model = model;
using (var sw = new StringWriter())
{
var viewResult = ViewEngines.Engines.FindPartialView(controllerContext, viewName);
var viewContext = new ViewContext(controllerContext, viewResult.View, controllerContext.Controller.ViewData, controllerContext.Controller.TempData, sw);
viewResult.View.Render(viewContext, sw);
viewResult.ViewEngine.ReleaseView(controllerContext, viewResult.View);
return sw.GetStringBuilder().ToString();
}
}

SignalR in Asp.net MVC 3: hub is undefined

I'm a newbie in SignalR. I'm trying to do this Progress Bar example.
I can't download and install the packages via NuGet, cause there is a proxy in my work that denies the access. So I include de DLLs and the scripts in project by myself.
My view code is below:
<h2>#ViewBag.Message</h2>
<input type="button" id="bookButton" value="Book flight" />
<br />
<b>Status:</b> <span id="msg"></span>
<hr />
<input type="button" id="percButton" value="Process pending emails" />
<div id="bar" style="border: #000 1px solid; width: 300px;">
</div>
<link href="#Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link href="#Url.Content("~/Content/gauge-bar.css")" rel="stylesheet" type="text/css" />
<script src="#Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/json2.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.signalr.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/signalr/hubs")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/simple-gauge-bar.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var bookingHub = $.connection.bookingHub;
$("#percButton").click(function () {
bookingHub.processPendingEmails();
});
$("#bookButton").click(function () {
bookingHub.bookFlight("fco", "jfk");
});
bookinghub.updategaugebar = function (perc) {
$("#bar").html(gaugebar.generate(perc));
};
bookinghub.displaymessage = function (message) {
$("#msg").html(message);
};
$.connection.hub.start();
});
</script>
My Hub code:
public class BookingHub : Hub
{
public void Send(String message)
{
// Call the addMessage method on all clients.
Clients.displayMessage(message);
}
public void BookFlight(String from, String to)
{
// Book first leg
Clients.displayMessage(String.Format("Booking flight: {0}-{1} ...", from, to));
Thread.Sleep(2000);
// Book return
Clients.displayMessage(String.Format("Booking flight: {0}-{1} ...", to, from));
Thread.Sleep(3000);
// Book return
Clients.displayMessage(String.Format("Booking flight: {0}-{1} ...", to, from));
Thread.Sleep(2000);
// Some return value
Clients.displayMessage("Flight booked successfully.");
}
public void ProcessPendingEmails()
{
Clients.updateGaugeBar(10);
Thread.Sleep(2000);
Clients.updateGaugeBar(40);
Thread.Sleep(3000);
Clients.updateGaugeBar(64);
Thread.Sleep(2000);
Clients.updateGaugeBar(77);
Thread.Sleep(2000);
Clients.updateGaugeBar(92);
Thread.Sleep(3000);
Clients.updateGaugeBar(99);
Thread.Sleep(2000);
Clients.updateGaugeBar(100);
}
}
When I ran the project, I noticed the bookingHub is undefined, and I've got null reference errors at this point.
What Am I doing wrong to get this error?
Thanks in advance.
Are you missing the attribute,
[HubName("bookingHub")]
on your BookingHub class? e.g.
[HubName("bookingHub")]
public class BookingHub : Hub
{
public void Send(String message)
{
// Call the addMessage method on all clients.
Clients.displayMessage(message);
}
...
Add Global.asax to your web app and add this to global.ajax.cs:
namespace SampleWebApplication
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapHubs();
}
}
}
See https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs

Uploadify in MVC3 does not work

Can't get this to do anything. When I click 'Upload File' absolutely nothing happens as well as I don't see any of the flash rendered to the screen. I believe this is somehow related to the jquery, but I am not sure. PLEASE HELP! If someone can mail me a simple VS2010 solution with uploadify working to infinitimods at gmail.com that actually works I'd appreciate even more! Thanks a bunch!
My Layout file:
<!DOCTYPE html>
<html>
<head>
<title>#ViewBag.Title</title>
<link href="#Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link type="text/css" rel="Stylesheet" media="screen" href="/Scripts/uploadify/uploadify.css" />
<script type="text/javascript" src="/Scripts/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/Scripts/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="/Scripts/uploadify/jquery-1.4.2.min.js"></script>
</head>
<body>
#RenderBody()
</body>
</html>
My index file:
#{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
#using (Html.BeginForm("UploadFile", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<script type="text/javascript">
$(document).ready(function () {
$("#file_upload").uploadify({
'uploader': '~/Scripts/uploadify/uploadify.swf',
'cancelImg': '~/Scripts/uploadify/images/cancel.png',
'buttonText': 'Upload foto',
'script': '/Home/UploadFiles',
'folder': '/Content/upload',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png; *.txt;',
'scriptData': { 'thisGuid': $("input#Id").val() },
'multi': false,
'auto': true,
'onError': function (event, queueID, fileObj, errorObj) {
alert("Error!!! Type: [" + errorObj.type + "] Info [" + errorObj.info + "]");
}
});
$("#btnSave").button().click(function (event) {
$('#file_upload').uploadifyUpload();
});
});
</script>
<input id="file_upload" type="file" />
<input type="button" id="btnSave" value="Upload file" />
<input id="Id" name="Id" type="hidden" value="5168e-yada-yada" />
}
My controller:
public class HomeController : Controller
{
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult Index()
{
return View("Index");
}
/// <summary>
///
/// </summary>
/// <param name="fileData"></param>
/// <param name="form"></param>
/// <returns></returns>
[HttpPost]
public string UploadFile(HttpPostedFileBase fileData, FormCollection form)
{
return "ok";
}
}
Uploadify requires jQuery. This means that you need to include the jQuery script before the uploadify script. If you had looked in your javascript debugging console you would have seen this error.
So, the layout:
<!DOCTYPE html>
<html>
<head>
<title>#ViewBag.Title</title>
<link href="#Url.Content("~/Scripts/uploadify/uploadify.css")" type="text/css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="#Url.Content("~/Scripts/uploadify/swfobject.js")"></script>
<script type="text/javascript" src="#Url.Content("~/Scripts/uploadify/jquery-1.4.2.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/Scripts/uploadify/jquery.uploadify.v2.1.4.min.js")"></script>
</head>
<body>
#RenderBody()
</body>
</html>
The controller:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult UploadFile(HttpPostedFileBase fileData, string thisGuid)
{
if (fileData != null && fileData.ContentLength > 0)
{
var appData = Server.MapPath("~/app_data");
var file = Path.Combine(appData, Path.GetFileName(fileData.FileName));
fileData.SaveAs(file);
}
return Json(new { status = true });
}
}
and the view:
#{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
$(document).ready(function () {
$('#file_upload').uploadify({
'uploader': '#Url.Content("~/Scripts/uploadify/uploadify.swf")',
'cancelImg': '#Url.Content("~/Scripts/uploadify/images/cancel.png")',
'buttonText': 'Select photo',
'script': $('form').attr('action'),
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png; *.txt;',
'multi': false,
'auto': false,
'onError': function (event, queueID, fileObj, errorObj) {
alert("Error!!! Type: [" + errorObj.type + "] Info [" + errorObj.info + "]");
}
});
$('form').submit(function () {
$('#file_upload').uploadifySettings('scriptData', { thisGuid: $('#id').val() });
$('#file_upload').uploadifyUpload();
return false;
});
});
</script>
<h2>Index</h2>
#using (Html.BeginForm("UploadFile", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input id="id" name="id" type="hidden" value="5168e-yada-yada" />
<input id="file_upload" type="file" name="fileData" />
<input type="submit" value="Upload file" />
}
And if you want to kick the uploading process when the user selects a photo you could get rid of the form and the submit button and set the auto property to true:
#{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
$(document).ready(function () {
$('#file_upload').uploadify({
'uploader': '#Url.Content("~/Scripts/uploadify/uploadify.swf")',
'cancelImg': '#Url.Content("~/Scripts/uploadify/images/cancel.png")',
'buttonText': 'Select photo',
'script': $('form').attr('action'),
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png; *.txt;',
'multi': false,
'auto': true,
'scriptData': { thisGuid: $('#id').val() },
'onError': function (event, queueID, fileObj, errorObj) {
alert("Error!!! Type: [" + errorObj.type + "] Info [" + errorObj.info + "]");
}
});
});
</script>
<h2>Index</h2>
<input id="id" name="id" type="hidden" value="5168e-yada-yada" />
<input id="file_upload" type="file" name="fileData" />
Also don't forget to checkout the uploadify documentation to better understand what the different options are used for and also you can see some examples.
You need to work around a bug with asp.net and flash.
This article helped me once: Working around flash cookie bug
Maybe this is a better solution: jquery file upload

Resources