开发者

Jquery thickbox to work with Url.Action link in Asp.net mvc

I want to implement a Jquery thickbox to show an image that is generated from my database in ASP.Net MVC. My link looks roughly like this:

<a href="<%=Url.Action("ShowPhoto", "Item", new { id = pic.pictureID })  %>" class="thickbox"><img src="<%= Ur开发者_JAVA技巧l.Action( "ShowThumbnail", "Item", new { id = pic.pictureID  } ) %>" alt="" width="100px" /></a>

However, I'm having errors popping out caused by the Url.Action link.

Someone please help me!!

EDIT: Sorry, I forgot to put the error in.

In the Visual Studio:

NullReferenceException was unhandled by user code. Object reference not set to an instance of an object. (This is highlighted in UnitofWork.CurrentUnitOfWork.Dispose();)

In my error log:

System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (&). at System.Web.HttpRequest.ValidateInputIfRequiredByConfig() at System.Web.HttpApplication.ValidateRequestExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

System.Web.HttpException (0x80004005): File does not exist. at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)

at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)

at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


I let the Html.ActionLink helper render out the links that include code for me, like this:

    <%=Html.ActionLink(Resources.Localize.Routes_WidgetsCreate, "Create", "Widget",  new { modal = true },
                                      new
                                        {
                                            rel = "shadowbox;height=600;width=700",
                                            title = Resources.Localize.Routes_WidgetsCreate
                                        })%>

Explanation: Resources.Localize.Routes_WidgetsCreate is a reference to Resources class to get localized string, "Create" is the controller action, "Widget" is the controller, "new { model = true }" is QueryString parameter, "new { rel ... } " these are the tag attributes.

This is an example of a Shadowbox link that opens modal window with the contents that ~/Widget/Create returns.

HTH


I don't think that this is to do with thickbox, but can you confirm that your two snippets of code (below) actually render a url?

<%=Url.Action("ShowPhoto", "Item", new { id = pic.pictureID })  %>

and

<%= Url.Action("ShowThumbnail", "Item", new { id = pic.pictureID }) %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜