How to make web radiobuttons work the way I want - asp.net

I’m working on an asp.net page that simplified looks like this: A group of radiobuttons at the top, some asp dropdownlists in the middle and an asp button labled ”save” at the bottom. I want the page to work like this: When one radiobutton in the group has focus you should be able select one of the others by pressing the up and down arrow keys. At the same time different dropdownlists should be disabled or enabled depending on which radiobutton is selected. Then you select values from the enabled dropdownlists. Finally, by clicking ”save” values should be fetched both from the radiobuttons and the dropdownlists and passed via a procedure to a database. I’ve tried out html input radiobuttons, asp radiobutton and asp radiobuttonlist but have not managed to get the page to work the way I want it to. I’ll be very glad for help to a solution.

Write a project to display the flags of four different countries, depending on the setting of the radio buttons. In addition, display the name of the country in the large label under the flag picture box. The user also can choose to display or hide the form's title, the country name, and the name of the programmer. Use check boxes for the display/hide choices.

Related

Refreshing ListBox outside an update panel

In my application, I have a list box(list of stores), Add and Remove buttons and another list box (selected stores).
I have Following requirements:
1. On click of Add button, copy selected items from the master stores list to the selected store list and clear the selection from master store list.
2. On Click of Remove button, remove the selected stores from the selected stores list.
I have added my master store list box and selected store list boxes to 2 different update panels and added triggers for each of the update panel. Things are working fine but one thing I have observed that it is taking unusually long to move selected stores from master list to selected list. I have around 5000 entries in the master list of stores.
If I remove the update panel for master store list, things are normal but I am not able to clear the selection. Am I doing something wrong? Is there a way to clear selection of listbox outside the update panel.
It sounds like your using UpdatePanels to move ListItems between 2 ListBox controls. This creates a overhead as each time you trigger the 'add' event it has to postback and render the UpdatePanel again (including the viewstate).
Have you looked into using jQuery to move your list items between your ListBox controls thus all the moving between boxes is handled by the browser. This will speed up the experience for the user?
You should also be able to use jQuery to clear the selection. If you can provide me a little snippet of your markup I can help you get it written up (or shoot me a message).
Brian =)

jquery: populating a select list from an autocomplete?

The basic problem: selecting a few items from a list of thousands.
The potential solution:
I have an autocomplete field that searches the db, and returns a name/id pair. This is working fine.
The next step is to preserve the selected IDs, and allow the user to remove some if needed. For this, I've been looking at using a select, and was hoping a UI something like that provided by this, but it doesn't work: it allows you to select items that already exist in the select, but doesn't work with a dynamically created select.
The final step is a traditional postback (using a submit button, this is in asp.net webforms) where I'll need to have access to the final list of IDs.
Are there other options for this?
Based on your comments below, there are a lot of ways to skin this cat. The following approach is similar to the SelectList idea only it doesn't use a dropdown list. The nice thing about the Listbox versus the DropdownList is that the user will be able to view many items at once. Of course, the choice of using a Listbox or a DropdownList doesn't really matter as they both essentially provide the same functionality. The key about this answer is that values are stored on the client until you're ready to submit.
Create an autocomplete textbox that dynamically fills a Listbox as you type.
Clicking on a Listbox item results in two things happeing:
The ID of the selected item is stored in a client-side array
A list of items are rendered/re-rendered on the page exactly like the SelectList. Clicking the red 'X' will remove the ID from the array and re-render the list. You'll have to do a bit of jQuery coding on your side but it isn't much.
The above steps are repeated until the user has selected all of their items.
Upon clicking "Save", only the selected items are submitted to the server for processsing.

.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.

Persisting Checkbox State Across Postbacks

I have a web form that binds a DataGrid to a, normally, different data source on each postback. I have a static CheckBox column that is always present to the left of the autogenerated columns. I achieve a TabControl effect with a horizontal Menu control above the grid, with each menu item being a tab that contains a different grid.
Now I would like to persist the state of these checkboxes for a particular 'tab', when another tab is selected. I would welcome any imaginative solution for doing this without using session variables.
I think the best bet for this is to have a different gridview for each of your "tabs". Use the MultiView control with a View control for each tab, and a gridview in each View. In the click event of your menu change to the correct view. Only bind each gridview once, and then your checkboxes will persist.

Resources