When I try show form take this error "MDI child forms cannot be show modally". Can Someone help me?
Ty
You can't show that form as a modal form - it just isn't allowed. However, as a work-around, you could put the GUI of the current form into a UserControl. You then put the UserControl in your MDI Child form, so that it resizes to fill the form. Likewise, you can create a different, non-MDI form to contain the UserControl when you want to show it as a dialogue.
Related
Working on some old code at the moment and a bit stuck
I have a main form that has a msflexgrid populated with data from SQL and on this form there is a button, which opens a modal form that allows me to enter data and save it to SQL (then closes the form).
The issue is the msflexgrid on the main form doesn't refresh after I save data from the modal, I need a way of automatically refreshing the msflexgrid after the modal form closes.
Any help would be appreciated :)
Maintain a global structure and update it when the changes are committed in the modal form. After modal form is unloaded, control comes back to the command button click event in main form and there, you update the msflexgrid with the data available in the global structure. Like this, explicitly we need to update the msflexgrid and it is not refreshed automatically.
It just hit me that because the second form is a modal form it only return to the main form when the second form unloads, so I can just add the refresh function right after showing the second form, I knew I was doing something stupid :/
Dim AddBusContact As New frmAddBusContact
AddBusContact.SetBusID (clsThisForm.BusID)
AddBusContact.Show (vbModal) 'code stops here until second form is unloaded
refreshgrid 'and I can just call the function that refreshes the grid here
I would suggest one more idea. If the modal form allows the user to cancel action, or to give up what started to do, probably it is better to trigger the grid refresh function before the modal form unloads and only if changes have been made...
Good day,
I have the following scenario:
I have a Razor view with a "#using(Html.BeginForm(....))" statement at the top of the page. Inside the using statement I have a few textboxes, whose values get populated by the user, and a button.
At the click of that button, a telerik modal window (displaying a partial view of the same model as the initial view) pops up so that the user can populate some more fields. Inside the modal window there is a button that must submit the entire form, which it does, however after I debug my action, I notice that the model is missing the values which were entered in the popup (partial view).
My code for the telerik window resides inside the using statement and looks as follows:
Html.Telerik().Window()
.Name("AddEditScaleWindow")
.Title("Save Scale")
.Content(#<text>#Html.Partial("AddUpdateFeeScale")</text>)
.Buttons(e => e.Close())
.Height(250)
.Width(350)
.Modal(true)
.Draggable(true)
.Visible(false)
.Render();
I tried different methods of getting the window to post its values but to no avail.
If I view source, I can see that the window (partial view) is inside the form. If I do a network trace I can see that the values being posted are all values that were entered on the view, but none from the partial view.
Does anyone have any idea why the values inside the window don't get posted?
Thank you in advance.
Matei
You might need to check this because I am guessing, but many dialog renderers create their dom elements below document and outside of your Form element. If that is the case with Telerik, you will need to do a bit of work on the client to copy the values from the dialog back to your other form.
I have a C#.NET MVC3 web app. I have a View that has a List of Models. This list can be long, requiring the user to scroll down on the View. When selecting one of the models in the View to Edit, the user is taken to the Edit View. After submitting the Edit View, the user is redirected back to the List View. However, the List View is now displaying back at the top of the list. How can I redirect the user back to the same position in the List View where they clicked the Edit button?
You would probably be better suited using a modal popup dialog to edit the data, rather than navigating to another page.
While it's possible to do what you want, it's a pain. You would have to get the scroll location via javascript, save it to a hidden field, post that to your edit page, along with record number and anything else, then re-post it back to your original page when you return, then read the post value and scroll to it via javascript.
All that is avoided if you just use a modal edit dialog, then when the dialog goes away the page is still in the same place.
I have a Form to create a new model object and persist it. That form is displayed in a lightbox or popup.
Some fields are dropdownlist showing related info that lives in another table (other model object related to the main model).
What I need to achieve is without leaving the creation form, create a new item of the related type and update the DropDownList in order to continue filling fields and finaly submit the form.
I have done this in winforms but not really sure which is the best approach in MVC 3:
Trigger another popup with a small form?
Use some kind of editable dropdownlist?
Place a small hidden form right next/after the DDL to allow entering the info to create an item in DDL (and to DB also)?
What do you thing is the best option?
Thanks!
There is no editable dropdown list in HTML. There are some toolkits that simulate it, but in general these are clumbsy and really complex. It's a lot easier to stick with basic controls.
You would proably do best to have a small + sign next to the field, and then popup an editing field that inserts the element into the combobox and sends it to the controller via ajax to add to the database.
An alternative to a second pop up is having a toggle add button. When toggled, then show a small area where you can enter the name. Using ajax, save the name, and then refresh your dropdown. This works well if you only have a few attributes to fill in.
I load a div using ajax:
$("#contentdiv").load('MyPage.php');
This is a "modal" div that shows details related to a picture the user clicks on.
The clickable pictures form a long list down my page.
I would like to have this modal div appearing on the position (have the same top value so to speak!!) of the picture that was clicked. Therefore the use does not need to scroll back to his/her picture of interest when the information div is hidden (closed!)
Any help is very much appreciated.
Thank you,
Carly
If you use the Modal dialog available in the JQueryUI package it should automatically do this for you.