InfoPath Drop Down Validation - infopath

I have a set of drop down lists about 12 in an InfoPath form. I need to set validation where users can only select from at most 5 drop down lists. How do I do this in InfoPath 2010?

You can make an invisible textbox with default value 0.
If user select something from drop-down list, make textbox value ++1.
And make a rule to disable each dropdown list if textbox value == 5.

Related

How to generate a dropdown list from another?

I want to generate a drop down list from another drop down list. That is I have a dropdown of countries. When selecting a country,another dropdown must come with values as states of that specific country. How to do that in asp.net using c#?
for each country you have, add a new list item to the drop down list, with text the country and the value some id of the country. On the second drop down list, set the auto post back property to true and add an event to the on selected item change. In the event code, get the selected item and by the second ddl.
Try it!
Tip: add a hidden field on the page, and on the selected item changed event from the first ddl, set the value of the hidden field, the selected value. On the page_load event, verify if the value is string.empty and if is an id in the value. If it is, bind the second ddl.
The technology you're looking for is called a Cascading Dropdown.
If you are using WebForms then Ajax Control Toolkit then this has one built in:
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
Otherwise you might need to do a further search if you are using MVC.
PS I'm not particularly proud of posting a link to the Ajax Control Toolkit as its not the best library out there but it is an easy drop in for what you want. If you're serious about doing a good job then I'd search for better options for cascading dropdowns.

Making drop down deactivate if one drop down is selected out of 3

I have 3 drop down lists , if a person selects from 1st dropdown the other two should be disabled. how to make that in asp.net using c#
You could use the ajax control toolkit and use the cascading dropdown control
you can do this in SelectedIndexChanged event of the DropDownList.
and enable AutoPostBack
Click the little lightning bolt in the properties in visual studio, then double click the selectedindexchanged to get the event to show up in the code. Also enable autopostback in the properties. In the selectedindexchanged event, look for the selecteditem value and set the control to enabled = false. you may want to start with the 2nd two already disabled and enable them on the selectedindexchanged. also, add a value in the ddl before the other values so you can make sure they actually selected a value from the ddl rather than a title. (if not ddl1.selectedindex = 0 then ddl2.enabled = true)

How to set always default value for first record in list view in aspx page?

I have an aspx page that uses a simple form to perform a search and the results are presented in a listview.
I have added a radio button to one of the columns and have set the value to be the records FlightNo. set always default value for first record in list view.
What I need to do is allow the user to select the row they require from the list view by selecting the radio button.
Use the "GroupName" property of the radio button control to make the dynamic radio buttons work as a group. You can add some client script to select the row on 'click'.

.net Validating a range of controls

I have the following scenario.
I have a search page which is split into two divs. In the first, a user can create query parameters using a range of drop down menus. In the second div a user can enter text to source the query parameter and narrow the search further. On the drop down selectedindex change event, a radio button is selected indicating which search is being looked at.
i.e.
div1 div2
ddl1 tbx1
ddl2 ddl4
ddl3
rad1 rad2
Based upon their selection, the user can then click a button, btnReturn, that returns the query.
So therefore, I have the following questions.
If I have a range of drop downs, in div1, what sort of validation do I need to set up so that at least one of these drop downs needs to be selected in order for a query to be selected. I cannae just put in required fields as not all of these fields are required, a minium of one of these is need to product a reasonable search.
I am assuming I can do all of this using .net validation?
I am thinking I can use Validation Groups for div1 & div2 but is it possible to assign both groups to one control i.e. btn click? Is it a case of doing the last part programmatically?
And that concludes today's essay! any help, as always, greatly appreciated.
Create a user control (or custom control) wrapping all dropdowns. Then create a Custom Validator, set its validated control to the wrapper you created. Write a javascript function to check that at least one value is selected in the dropdowns and set the ClientValidationFunction property of the custom validator to use it.
Yes.
No, this wouldn't work in your case (unless you want a postback when switching between the DIVs). Create two submit buttons, and hide them on the client depending on the selected DIV.

Displaying a Drop-Down List While Editing in the GridView

I have a datagrid which shows the search reasult(time entered by the user preveiously)on a button click event depending uppon the input name or date enter by the user,i want to show a drop down list for a field selection like depertment whenever user want to edit the data in datagridiew,i am using access database & asp3.5.
You can use the Template Columns to specify a dropdown list for when you edit a datagrid. You can also do a bit more on the code side if you want to do things dynamically, but the Template Columns will allow you to override the standard textbox that shows when you edit.

Resources