Posting a master and details on save - asp.net

I am completely new to the MVC and struggling with concept that would be easy in webform application.
I am implementing a functionality where I have to allow a user to add multiple phone number for Home, Work and mobile on a single view. So the view has below fields.
Customer Name
Customer Email
List box to select: Home/Mobile/Work
Textbox for the selected category
User is allowed to add multiple contact numbers and finally on save it should be stored in Customer table as well as customer's contacts table which has Customer's ID, Contact Type and Number.
It would be great help if you have working example of it.
Thanks..

Related

How to fill fields in Zoho CRM automaticly

I have this situation:
I have custom button in Zoho CRM where I want to create new Account. When I click the button, it opens page of my Zoho Creator Form, then I fill in this form and click submit. What I want to acomplish is that when I submit the form, I want some information from that form to be filled in CRM creation Account. I was thinking about using url. For example in Zoho Creator If I extend base url of my Form and finish url by e.g.?text_field=abcd when I go to that URL, the field "text_field" is filled with "abcd", but when I try to use the same mechanism, it wont work on CRM. is there any workaround?
In CRM, there is no option to fillup data on load. on the success you can write a function or using feild update you do that.
Create a function that would get called on your form submission.
Extract the values from your creator form, then do
Zoho.crm.createRecord() if you want to create record or zoho.crm.updaterecord, with update record you'll have to provide a record ID.
If you only want to create a record its pretty straightforward, read about zoho.crm.createRecord()
To answer your question it is not possible to achieve the same functionality in CRM. Although what you can try to do us use
create record using zoho.crm.createRecord
On successful creation redirect to CRM Accounts Edit page.(using /edit it depends on your CRM and the layout id's )
record is created first and than user has prefilled information
If user wants to add extra information than they can add and save the record

Gravity Forms Multipage Form, dynamically populate from existing form entry based on unique key

I'm working with Gravity Forms (WordPress) on a pair of forms for a school. They have an initial form for applications. Each submission gets assigned a unique five character key to identify it. This is saved in a hidden field. This form has things like name, email, phone, address etc. This form is up and running, working great.
Once a student has been accepted, we now need to have another form that is for registrations. This form will be a multipage form with more detail and various questions about history/parents etc. My thought is that the first page contains a single field that asks for the key assigned to their application. Once this first page is submitted, the form would query the database based on the key and return any info from the original application that applies to the second form. So things like name, email, phone wouldn't have to be re-entered manually.
I'm starting down the road of dynamic population and running into some trouble. It appears things operate differently on multi-page forms, and depending on whether you're using AJAX or not. Has anyone had experience doing this kind of key lookup for form population? I could do this in vanilla PHP/MySQL without a problem, but the Gravity Forms stuff has me stumped.
Your question is not clear enough and is left open for interpretation. However, since I ran into problems with multi-page gravitiy forms as well, and could find very little help online, here is my experience.
If you go from one page to the next, you can access field values from previous pages using rgpost("input_" . YOUR_FIELD_ID);. Checkbox collections are accessed by "input_".FIELD_ID."_".OPTION_INDEX. Dynamically filled dropdowns seemed to get reset in my experience. If this happens to you, before moving to the next page, you can copy any values from these fields into hidden fields, and read from the hidden fields.
Fields that already have a default value (field->defaultValue) are NOT updated even though the appropriate hooks are triggered. E.g: add_filter('gform_field_value_my_field', 'populate_your_field'). A dump of the value you return in populate_your_field will show a different value than when you inspect my_field, which is supposed to receive this value. my_field will retain the first value it received and wont change anymore.
This is a problem when your fields depend on input of fields from previous pages, and users go back and forth changing those. Your dependend fields wont update on any hook. I've tested extensively with gform_field_value, gform_pre_render, gform_field_validation and gform_post_paging.
I found one solution: echo a hidden div with data attributes in the gform_pre_render hook, and populate the fields through javascript.
add_filter('gform_pre_render', 'dynamic_population', 10, 1);
function dynamic_population($form) {
echo "<div id='my_data' style='display:none' data-myjsonarray='.json_encode(my_json_array).'></div>";
}
In your gravity form, you can create a html field and add javascript in there.
<script>
window.onload = function() {
//custom function that fills given gform dropdown with given array
fill_dropdown(
jQuery('#input_1_1'),
jQuery('#my_data').data('myjsonarray')
);
}
</script>
Hope this somehow helps someone.
Gravity Forms Populate Anything can handle this really well.
Add a field to your form where the user would enter their reference number.
Configure a field to be populated with the entry data based on the provided reference ID where it matches an entry that has the same reference ID:

multiple updates in one submit in SPA page

I have a web page written in ASP.net where it finds a list of employees, displays them in a listview and allow the user to change different statuses for each employee.
On each row I have employee information like name, date of birth, address and then 4 status fields that are displayed as checkboxes and a comment field where the user can type a comment explaining why they changed a certain status.
Currently in Listview, there is an edit, delete button when they click edit, the checkboxes and text field are displayed the user updates them and click save.
asp.net will do a postback to save the changes for this row and then fetches the data again to refresh the list.
The problem I am having is the list is very large (more than 3000 names), so I am using pagination to show 50 to 100 names on each page. This is still a big performance problem because after every line update a query needs to run to fetch those names again, and with ASP.NET the server is generating the html and passing everything to the browser.
The customer wants the page to be mobile friendly too, so I am thinking to redo the page using Angular on front end with web-api or mvc.net on back end that returns JSON.
My question is there an easy way to do this and allow the user to change the status for multiple employees on the same page at once and then click one submit to update all the changes? if I do it this way, there will be less queries to run and it will be faster for the user because they don't have to wait after every line update.
Any examples will be greatly appreciated, unless there is a different way to implement this, in this case please let me know.
I have a thought that may work.
On load render names and use pagination.
Then use ajax to send the post to server and change data in database.
When editing has returned successful then only change the values that have been edited using javascript for the user to view.

Search functionality in asp.net

I'm learning to create a webapp using asp.net and C#. And I already create a basic user database webapp. Wherein I display all the user information in a tabled manner. So basically I just used the table element from HTML and not the gridview control.
But I have a problem right now, I want to add a user search functionality wherein I will just input the user's firstname in the search box, so then when I click the search button it will display the user information in a table format. So I don't know how to implement it because I used the table element not the gridview. Where to I write the data that I searched?
Please advise.
Many thanks
It doesn't matter what you use to display the results, you can reuse that code. The only thing you need to change is the way you select the data from the database based on the firstname.

How can I use current user (default membership) as a data field in DetailsView?

I am new to asp.net. I have a details view control on my page. I use linq to sql. My details view is an admin panel for data entry page. So some members will enter some news to my database. I want to use "Writer" Data Field to be filled automaticly with the current logged user. How can I do that?
Thanks
You will simply need to inject the username into the field at some point.
There is not a point-n-click drag-n-drop solution to this case, and there are many ways to accomplish this and to go into further detail is likely not necessary.
Just get the value into the textbox or field as the page is served where L2S can pick it up on the postback.

Resources