ASP.NET Keep fileupload after postback - vb.net

I'm writing an intranet ASP.NET page using VB.NET. I've run into a particularly nasty problem dealing with handling file uploads. I'll do my best to explain the problem, and perhaps someone can help.
My problem is almost a duplicate of this one, or this one, except (other than the filename) I don't care about sending the file to the server until the other data has been reviewed.
Here's the situation:
Joe Q. Dataentry inputs some data into several fields. The first 3 are drop down, and when he changes the selection, a postback event is fired that queries a database for valid entries for the other drop down selections. After selecting the values, he inputs some other data, chooses a file to accompany the data and clicks the "Update" button. When he hits the button, it fires a postback event that sends the current data to the server to be validated. The data will create a change in the database, so he is presented with a view of the current state, and what it will look like when his changes are made. He can now either confirm or cancel the operation for whatever reason.
Part of the data he will see involves the extension of the file which may be a PDF, or could also be some image file or other document.
Now here's where my problem is - on each postback event, the fileupload dialog is cleared. I was getting around it by creating a temporary file on the first postback and then renaming if he clicks OK or deleting on Cancel... but I need to do a variety of things, based on the previous state of data and the filename. I've tried to keep some session variables to retain the filename, and that works OK for just renaming the file, but for what I need to do it gets unwieldy.
What I want to do is be able to have the postback event to present the changes, and then when the user clicks "OK", submit the file. Is there any possible way to do that?
One of my thoughts was to do some of the validation client-side (I'm already re-validating server side so I'm not too worried about data security there), but I don't know how I could get the information from the database query.
Thanks for any help, and reading my slightly convoluted story/situation!
EDIT:
It appears that what I want to do is prevent a certain button from firing a full postback. Is there any way to do that?
EDIT II:
I have an update panel on the page already - is there any way for the button to only post what's in the update panel?

What you might want to do is place your drop-downs inside of an ASP.NET AJAX UpdatePanel, and keep your file upload control out of that.
Your update panel will do the post backs and allow your validation logic to happen without submitting the file, then when you hit your final "Save" button (which is also outside of your UpdatePanel) the entire form will be submitted back and you can work with your file then.

Related

Allowing User to Select off of Partial Records in a Continuous Form in Access

I am creating a form in access to allow users to input multiple production records for a day.
The form is set as a continuous data entry form and has data validation in place to ensure the information being entered is consistent.
I am having a problem where if a user starts typing something on a new entry, they essentially have no way to back out of it or cancel the entry without completely filling out the form.
I want to keep the data validation to ensure the data being recorded is accurate, but also do not want to lock users into an entry unless it is completely filled out.
I think the ideal would be to allow users to create a new record or select other records without needing to save the current record.
If it would be possible to make it so records only save when a button at the top of the form is pressed I think that would be ideal, but I have not found a good way to do this without requiring it on every single entry.
I have attached a picture of what I am talking about, there could be various error messages but essentially if you try to click off when a record is incomplete it will give an error until the entire form is filled out.
Example of Error Message and Image of Continuous Form
'deselect' without saving but still save what had been entered up to
that point.
That you can simulate by setting the DefaultValue of each control in the AfterUpdate event of each control:
Me!SomeTextBox.DefaultValue = Nz(Me!SomeTextBox.Value)
However, I'm not sure that will be a good idea. And you may have to reset the default values when opening the form.

react-admin pristine state after loading data via dataprovider

I've got an issue due to a timing issue with react-admin, that i'm looking for a little help on.
The situation is where user A creates a resource, and user B, on a different PC, then goes to list and edit that resource.
For user B, the list page loads the full dataset of 10 resources, then the edit page re-loads the single resource that is being edited.
However, the specific process on the edit page seems to be:
Render page
Render resource cached from the list page
Request the single resource from the API
Populate the edit form with the updated values from the API
Set the form to dirty
That last point is critical, since I have an action button that is only enabled if the form is pristine, so the user has to save any changes before triggering the action.
But in this case, the list view and the edit view seem to return the same data for the resource, so I'm not sure why the form is being set to dirty.
Any thoughts?
Regards,
Andy
This isn't a complete answer, but I hope it helps you save some time. I recently upgraded React Admin version from 3.5.3 to 3.6.0. I noticed that the Save button is now sometimes disabled unexpectedly, and inconsistently. For example, I may navigate to the edit view of a resource by clicking a link and the Save button is enabled, but if I refresh the page, the Save button is disabled. Apparently, the Save button is supposed to be disabled when the form is pristine. So between 3.5.3 and 3.6.0, it seems that some changes were made to either the pristine handling or the Save button's reaction to pristine, and it is not working consistently.
I see there is a new issue opened three days ago regarding overriding the Save button behavior, wrt pristine. https://github.com/marmelab/react-admin/issues/4913 . So, it seems the dust hasn't settled on this behavior. Perhaps a bug will be found.

Access Field Not Refreshing

To start, I am using Access 2003 and have a similar project that works correctly that I designed.
I am stumped as to why a particular field will not change dynamically like every other field until I "refresh".
Currently I have a task list that lists all items that need to be works. Containing a Status: New, Open, Closed; The account number, person who is working it and more.
The tasklist is just a form with a subform with a datasheet view that opens the task when you double click it. If a user opens a task, that task will be locked until they move on. If any information that is viewed in the task list is changed, it dynamically updates, all but the Status (which really is the most important) until the user manually refreshes it.
Does anyone know what I need to look for that would cause this? The Status is stored as an integer that joins with it's true value. I thought this may be the reason, however I have a similar tool I designed does not have this issue.
I've look into how they are joined, the code that changes this value, everything seems the same between the working and not working.
Any advice?
Thanks in advance.
edit any fields that are JOINED, do not seem to dynamically update until I hit refresh. However, the other database has this working. What am I missing that is different between them.
Solved.
I changed the object displaying the field from a textbox to a combobox, showed two columns with widths 0";1" and it works.

Using querySaveDocument to additional information

We are trying to save some additional information with a document using the QuerySaveDocument event. However it seems that it is not being triggered at all.
<xp:executeScript script="#{javascript:setField(document1, 'cCustAddr1_fi', 'test');}">
</xp:executeScript>
This is our basic script. All the setField() method does is use replaceItemValue to try and set the field. However it seems that QuerySaveDocument is not even being triggered since we can write pretty much anything and the document will still save without problem, even if it would be impossible to execute.
We have also tried using a simple document1.getDocument().replaceItemValue() script, but again I dont think it even attempts to execute. Our documents save perfectly fine too,
Do you see any reason for this, are we doing our saving wrong, or should we be attaching data onto the document in another way?
Thanks.
Your other question on Unplugged (Using other dialog controls in iOS) suggests that you are using the Unplugged Mobile Controls project.
If that is correct then my comment above applies - the querySaveDocument event won't get fired . You can look at the code in UnpSaveDocument.xsp and possibly add your own SSJS code to that.
Alternatively, if you want an additional item created on your back-end Notes document then you should just be able to add a hidden field to the UnpFormEditor that is bound to the document1 data source and using the relevant item name you want.

SharePoint 2010 and Editform.aspx

In one of my custom application user wants to keep EditForm.aspx open once list item is created and he can keep saving the same record without redirecting user to DisplayForm.aspx page.So what I'm doing after list item creation I'm loading EditForm.aspx again.
Now the problem is when form is opened in Edit mode and if existing field is modified that doesn't gets updated in the list item but if something new added to the field then it gets saved to the list. I believe it's postback issue but not sure how to pass latest form data upon save.
If this was my task, I would create a new application page that replaces the edit page on that list.
(You can use powershell / object model to set the url of the new / edit / display pages)
Ignoring the ribbon, the edit page is actually pretty simple. It shouldn't be too difficult to create a custom one, that has the submittal behavior you are interested in. Indeed, since you are keeping the exact same field names and input types, you may be able to simply inherit the default form in yours, and simply override the post call.
I suppose it might be possible instead for you to write some javascript to hijack the submit post of the default edit page, but this seems messy to me, and I probably wouldn't go that route.
If you don't need to complete this task today, I've been meaning to push to github some code I wrote a few months ago. That code is a custom aspx edit/new/display page that is extremely easy to customize / implement. I could forward you the link tonight when I get out of work.