How can I do a messagebox in asp.net mvc? - asp.net-mvc

I've been trying to do a messagebox in a controller in asp.net mvc, but every time I type MessageBox or MsgBox it doesn't give me the option to import a namespace...
What can I use that would be similar to a MessageBox?

the MessageBox functionality is provided by the System.Windows library which is not available in the ASP.NET MVC context, since your site is running within a browser.
Instead, you should use a javascript library to show a message box.
You could use the following in order to display a message box
alert('Hi there')

Message box can be shown using Javascript, you can write your own HtmlHelper for this or have a partial which takes the message as input and diplays it, in this way you can reuse your partial

you could render out a script tag as a actionresult that has
alert('{0}'); where the placeholder is you message

I suggest using the jQuery UI dialog. It's incredibly easy to use, very powerful, and really easy to style.

Related

How to show Find/Replace Dialog on SpreadsheetGear workbook?

How can I show from code SpreadsheetGear dialogs like Find/Replace?
There is WorkbookDesigner form which has most of those dialogs in main menu, but how can I implement it myself?
The "Find and Replace" dialog is not part of SpreadsheetGear's public API and so cannot be instantiated from code. Developers using Windows Forms have been able to "hack" this since a keyboard shortcut does exist to launch this dialog from the WinForms WorkbookView. This has been done by sending a Ctrl+F keystroke to the WorkbookView, using something like the following:
workbookView.Focus();
System.Windows.Forms.SendKeys.Send("^f");
WPF doesn't support this model since it is part of Windows Forms. However, it appears that using System.Windows.Forms.SendKeys.SendWait("^f") might work instead, but I make no guarantees of this.
Generally speaking, if a particular "dialog", such as the Find and Replace dialog, is not listed in the SpreadsheetGear.Windows.Forms namespace, then it is not available to instantiate from code.

why open event of the popup window in the asp.net mvc kendoui grid doesnt work?

I used asp.net mvc kendoui to create a new website.I used kendoui grid to create a grid list and used the Popup template window to edit.but when i wanted to test the open event of the popup window,i found it doesnt work.And when i saw the html source code generated by kendoui,i found the js handler did not exist in the grid code.Can anyone help?Anyone had the same issue?
The code like:
#(Html.Kendo().Grid<T>().Name("test")....Editable(edit=>edit.Mode(GridEditMode.Popup).TemplateName("Editor").Window(w=>w.Events(e=>e.Open("OpenWindow")))))
<script>function OpenWindow(obj){}</script>
I know this question is old, but Telerik has stated that the events on Popup windows do not work on Razor syntax. You would need to use the grid's Edit event.
Here is the answer from Telerik
Here is another solution given on Stack Overflow

ReportViewer in MVC 4 partial

I am still unsure the best way to go about it.
I've read alsorts of resources, yet still no closer to a working solution.
I created a partial ASCX file. Added Report viewer to it, then rendered said partial in my CSHTML file. This was the closest I have come. In that I can see the report viewer, buttons etc. But for some reason the data never shows.
I have tried ASPX page inside an IFrame But this is not the way I want to go, about making this solution work.
Loading an ASPX page outright. But I lose my _Layout.cshtml main page style.
Some people suggest changing all sorts of things in config / Global.asax where as some say its not even necessary.
Ideally I want to have it as a partial in a page. But can deal with it being the only thing on the page, if I keep my main layout.
My experience with the older syntax / pages / non-MVC is limited to this project - trying to get this to work.
My data is linked through the components setup. The connection works fine in aspx page, as single page or iframe. But not in ascx.
The ReportView control requires ViewState to be enabled. In ASP.NET MVC such notion no longer exists. This means that you cannot use this control inside a native ASP.NET MVC view or partial. You can use it only in a classic WebForm (not in an ASP.NET MVC View) and the embed this WebForm inside an iframe within your current ASP.NET MVC view or partial. You have the possibility to render the report as an image for example and directly stream it to the response without using this control. Here's a blog post which illustrates the technique. So you could have a controller action which generates the report as a JPEG image and then link to this controller action from your view using the <img> tag. Unfortunately this makes only a static copy of the report and the user cannot interact with it.
You might also checkout this blog post which illustrates how you could run ASP.NET MVC and classic WebForms side by side.

Ajax Error Unknown server tag 'asp:AutoCompleteExtender'

Unknown server tag 'asp:AutoCompleteExtender'.what should I do to use AutoCompleteExtender in MVC.I have no problem with this when using in aspx page holding single textbox/ajax
what should i do to use AutoCompleteExtender
Nothing. You shouldn't use server side controls in an ASP.NET MVC application. I would recommend you taking a look at jQuery UI and its AutoComplete widget.

Stop Umbraco form stealing internal links

Sometimes I want to write the entire link to a page, which can be good if in example a visitor wants to print the page or just copy the url from the web site. The thing is if I write http://www.mysite.com/licensing/terms ubmraco cuts that and removes the http://www.mysite.com, both from the link it self and from the text.
Ie
/licensig/terms
What i want is that it should remain as
http://www.mysite.com/licensing/terms
It does not matter if i write the link in the source editor, if i write it in the html source editor or if I use the link tool in the rich text editor.
Anyone know how to fix this?
Use umbraco.library:NiceUrlFullPath($currentPage/#id) in your XSLT to get the full domain and protocol included in your URL, or umbraco.library.NiceUrlFullPath(Node.GetCurrent().Id) in a usercontrol code-behind or binding.
HTH,
Benjamin

Resources