這是我的控制器的動作是什麼樣子 -asp.net的MVC 3調用JavaScript
public void GetResizedImage(int height, int width, int GroupingId)
{
//Generate image here
image.RenderToStream();
//here i need to execute "$("#modalDialog").dialog("option", "position", 'center');" to center my dialog after image is rendered.
}
在我的客戶端,我分配圖片src這樣的 -
var imgsrc = "Group/GetResizedImage/?height=" + height + "&width=" + width + "&GroupingId=" + GroupingId;
$("#ImageDiv").find("#MyImage").attr("src", imgsrc);
和圖像呈現在jQuery對話框中,所以對話框調整大小,它隱藏在瀏覽器的右側,這將創建水平滾動條,我不希望我的屏幕上滾動條
有沒有anywa在渲染圖像後,以中心我的jquery模式對話框? 我知道我曾經在webforms中使用ScriptManager.RegisterClientScriptBlock
,但由於這是MVC,我無法使用它。 任何幫助,將不勝感激。 謝謝
這不是一個操作方法,因爲它的返回類型爲void 。控制器操作方法必須返回ActionResult或ActionResult的子類。 – danludwig 2011-12-15 22:42:47