Adding Datasource to ReqTransPOListPage - axapta

I'm trying to add a field from EcoResProduct to the form ReqTransPOList page but can't seem to figure it out. I've added the datasource to the query but it won't let me add any fields from it to the form. I can create a new view and adding fields to that is fine, but just can't to the form itself.
I haven't dealt much with interaction classes, am I missing something associated with this?
Thanks!

This has the easiest, yet hardest to find solution. Even though the data source was showing in the form I had to select the Data Source head and select the Query line in the properties and hit enter(you don't need to change it, just hit enter). This apparently forces a refresh that compiling, restoring, restarting AOS, and export/import couldn't do.

Related

What is the right way to handle mode parameters in MVC?

My app has a number of ambient properties, like the current CountryId, DocumentMode, etc. As I learned in a previous question, the current value of these properties should not be stored in the Session, but rather sent in the query string on every page request. So far so good.
So when I build a page, I want to arrange that all the action links look like this:
/controller/action?CountryId=x&DocumentMode=y&...
I can easily do this by checking the query string and slipping in the current value of each of these variables.
The question is, what's the right way to notify the app when one of the values changes?
Specifically, at the top of each view, I have a select dropdown that shows, e.g., all the countries. What should happen when you select a new one?
Right now, the change triggers a javascript function call that replaces the CountryId in the query string, and calls an action that just reloads the original page, but with the new CountryId set, and so the new action links are rebuilt. But this seems sort of kludgy. Is there a more elegant way to just update all the links on the page without needing a server refresh to do this? (I could always cook up some script to do this, but it doesn't seem trivial, and I don't want to reinvent the wheel if there's a built in way to do this.)
Any help much appreciated. Thanks!
You could put the part of the page that changes in a partial view and reload that view via AJAX each time a control is changed.
Partial rendering after page loaded
Alternatively you could just write some javascript to update all the links. Post some code and I'm sure you'll get some suggestions on a good way to write it.
I decided to keep things simple for the time being and just refresh the whole page, which recreates all of the links. My app is low volume and this suffices for now. If I ever need to build an app where the server can't be foolishly stressed like that, I'll see about the swap-in-place solution.

Drupal won't let JQuery add to a select list in a custom form

I have a form with a drop-down 'select' element that the user will sometimes need to add to. So, I added a link to open a Modal Frame form, created the Modal Frame form, and made its _submit() function add the new data to the table that holds options for the select element. Then it "returns" the new ID and name to the Javascript callback (the way Modal Frames do), and the JS callback adds the new element to the dropdown, and makes it the currently selected element in the browser, with JQuery. This all works great.
Finally, the user submits the original form, and gets the error "An illegal choice has been detected. Please contact the site administrator."
The form building function creates the option list from the database, which (I checked) DOES include the new option, so I'm guessing Drupal is using a cached version of the form rather than re-building it before it does the automatic validation. If you go back one page, then forward, the newly-added choice is there in the list.
I tried adding:
global $GLOBALS;
$GLOBALS['conf']['cache'] = FALSE;
to the function that builds the page with the problem, but it made no difference.
FYI: this is part of a multi-page form, if it matters.
I also thought about trying to add the option to the cached version of the "parent" form in the "child" form _submit() function, but don't know how to get the form_build_id of the "parent" form. Besides, that seems like way too much of a kludge (though I could be wrong about that).
Ideas?
You are submitting the form which is different then the time of form render so Drupal consider it as malicious input. If you want to skip that malicious check then add below line as property of your form in your_module_form() function.
'#DANGEROUS_SKIP_CHECK' => TRUE,
This will solve your problem but make sure that you are adding manual validation to protect from malicious inputs :). Hope this will help you.
I think you'd be better off using Drupal's AHAH functions to request an updated select element from a callback function. This way the cached form is rebuilt on the server side and you don't need to add the dreaded DANGEROUS_SKIP_CHECK. Here's a tutorial for Drupal 6:
http://randyfay.com/ahah

Updating Only Changed Rows Using GridView Control

what is the best way of updating to db only the changed rows using gridview?
i have a gridview control that has inline editing and when the user edit the row there are two options "Update" or "Cancel" so user might just click update button without really updating the row...
how can i make sure that, user really changed the row?
I don't use it much but are you sure the GridView doesn't handle that automatically if you are using the built in edit functionality. You could try debugging the OnRowUpdated and OnRowUpdating methods to see if they even get called when save is clicked and nothing has been changed. Even if you don't need them just add them so you can put a break point there to see if they get triggered.
i could not find what i wanted to do so the easiest way of doing this is:
load the data in a object and compare with Equals it works fine in my scenario and the only cons is trip to db which is fine in my case.

Exit button, without saving to database when items have already been added

I do not have any code to show, but using asp.net, vb.net, and SQL with stored procedures.
If on a page I have an item that is added to the database and therefore that information is "saved", is there a way to have an ("exit without saving") button on the page that does away with those changes?
Using infragisitcs ultrawebgrid, you add an item to one table. You can add an item to another table on that page. i assume adding these items to the table automatically saves in the database. There is also a text box but without clicking save I do not believe that those items are actually added to the database. Update panel is used, I don't know if that matters.
If after someone adds to the table but then decides.. oh wait.. I don't want to do this just yet, is there a "one-click" way to act as if I never visited that page to add info? I'm assuming it would be deleting the entries but this would have to be limited to deleting ONLY those items added while making... we don't want people adding info, then going back and deleting once the "save" button has been pushed.
There are a couple of options for handling 'undo,' you can handle it after they save by using markers in your database, or you can cache changes until they hit a 'commit' button that then saves their changes in the database.
Caching changes is the cheaper implementation, but then you can get caught with users who haven't figured out that they're not really saving anything until they take that final step.

ASP.net - Adding a control in code, how do I get it via FindControl()?

I create a table in code, add rows and then cells to it. In each cell there is a checkbox which has an ID I set.
I add this table to an updatepanel, and later on I want to find out which checkboxes the user has checked/unchecked.
I don't know the best way, so what I did was create a button that checks. I kept a reference to the checkboxes, and tried changing the checkedvalue in code, but this did not update my webpage. I figure it loses the reference once it is added in code.
So I tried to use Page.FindControl and passed the original ID I gave it, but it doesn't find it. I am guessing this is because it puts a load of crap before the ID before adding it to the page...
So basically, what do I do to check the if the checkboxes I added have been altered or not? A CheckedChange event didn't work either.
You may have to use a recursive FindControl

Resources