I have a simple dropdown list, currently using asp:ListItem to populate tho this will be changed to a db at some later point.
Depending on the users choice, I then want to present them with between 2 and 5 Lables and Textboxes so that they can enter values then run an algorythm.
The Lables and Textboxes, let call em items, will always have 1 and 2 shown, however 3-5 can be present in any combination but preferably always in order so 5 never comes before 3 and 4 etc.
I also dont want there to be any gaps if say 3 and 4 are missing, so making them invisible isnt an option either.
Is there some form of table or listbox option than can allow me to simply do the above ? Or do I have to change the text etc for each "line" as required ?
I basically want the following (example with Lines/items 3 and 4 not required) -
Item1 VALUE ______
Item2 VALUE ______
Item5 VALUE ______
Many thanks, George.
The best thing is that according to user choice make Item3 as Item5 and hide all other controls
:)
Use jQuery or basic Javascript to set the display property as none for the items that you don't want to be displayed. This way there wouldn't be any gaps on the UI for the hidden items.
Related
I have the following scenario:
the main aspx page
a user control inside that aspx.page, let's call this parent_user_control
two RadComboBox, with only numbers on them.
The first one, RadComboBox1, for example, when the user chooses 2, it will dynamically generate 2 user controls, let's call them child_user_control_1
The second one, RadComboBox2, for example when the user chooses 1, it will dynamically generate 1 user control, let's call it child_user_control_2.
child_user_control_2, has another RadComboBox, called RadComboBox_2_1, again with numbers only, that dynamically generates another user control, called grandchild_user_control.
grandchild_user_control has a RadComboBox called RadComboBox_grandchild, with an EmptyMessage="Please select", and only numbers, but the numbers must match RadComboBox1, as in, when 2 was chosen, only options 1 through 2 should appear in this RadComboBox_grandchild. If the value from RadComboBox1 changes to 5, then the range of values in RadComboBox_grandchild should change to 1 through 5. Same if it decreases from 2 to 1, only the value 1 should be available.
I properly handled the recreation of dynamic user controls, so all values persist, and the values in RadComboBox_grandchild get properly updated.
Here is the problem:
When I change the value to a smaller number, say from 3 to 1, and I have, for example, the value 2 already chosen in RadComboBox_grandchild, the list gets updated, and in the code_behind the values change correctly (as in selectedIndex is -1, selectedItem is null, etc.) BUT, I do not see "Please select", I still see the value "2", even though it is no longer on the list.
How can I avoid this? How can I make it show the EmptyMessage "Please select" again? I tried the ClearSelection method, but it didn't do anything because it already is without a selection. It seems to me that the mechanism used to persist the values from the previous postback is forcefully persisting a value that no longer exists.
It seems to me that the mechanism used to persist the values from the previous postback is forcefully persisting a value that no longer exists.
It is; you can turn EnableViewState property for control on or off.
I suppose you need to clear properties Text and/or SelectedValue of your Telerik.Web.UI.RadComboBox instance that persists outdated value.
i have a winform C# app that retrieves values from a sql server and has to store in the checkbox as text value. the user will check on the checkbox and save the corresponding value back to the table(This part is later on.)..
here is how my form looks like.
Now, say for example, in my table it holds 12 subject e.g sub1, sub2...sub12.
there is no distinction in the table as to which subject belongs to which semester.
herein lies my problem, i want to be able to get the subjects say for sem 1 and only display in the first 4 checkboxes, suppose there are subjects from sem 2 show them in the checkboxes in the fourth panel.
i know i have to compare manually all the values, if they contain words like"sub1" if yes the check a checkbox. but there are too many variables here....
is there any way to solve my problem ?
I am populating a ListView with a DataTable from the code behind. The problem is, that the ListView is becoming too long with too many items.
I am wondering, how can I make this:
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Into this:
Item 1 Item 4
Item 2 Item 5
Item 3 Item 6
Maybe I'm overlooking something, but I can't seem to find the answer.
Please not that I want to keep it in one ListView, so I'm not looking to split the items and put them into multiple ListViews.
Solution: Use a DataList in stead of a ListView. See Tim's answer.
Use a DataList instead. It has a RepeatDirection and RepeatColumns properties. The former would be RepeatDirection.Vertical and the latter 2 in your case.
Gets or sets the number of columns to display in the DataList control.
I am developing a small business application to display the report retrieved from database and I have a checkboxlist consisting of four checkboxes, also a combobox. Now, I am retrieving the required info from database to combobox with 4 items while on page load, which is ok. Not only this, but also retrieving the checkboxlist DataTextField on the checkboxes from database,which is also ok.
As for my question on this issue, lets assume that I have a combobox with 2 items, name and age and also 4 checkboxes named with George, Michael, 23, 33.
Here, 23 and 33 belong to Name(combobox.selectedindex[0]) items of checkboxes and George, Michael belong to the Age item of combobox. Then, I want to display on the listbox that when clicking Name item of combobox, checkboxes of Michael and George come to the screen as checked automatically and when clicking the button, those selected values of checkboxes are displayed on the listbox for both nMme and Age items of combobox in the same logic.
I tried to make this several times, but fail to achieve this goal. How to do this, can you please lead the way to me on my this issue?
Thank a a lot for replying.
The simple way would be to add Name or Age as checkBoxListItem.Tag to the corresponding values and everytime you change selection in the combobox you iterate through all the checkBoxItems and chack the ones with the corresponding tag and uncheck the others.
I have a repeater with an ItemTemplate contains a CheckBox, TextBox
My repeater represents a check list plus a TextBox to put a comment to each item I select from the list.
Now, I've a page for editing an existing shopping cart in my database and it uses this repeater to enable the user to update his list. So I need to update the List with the previous selected values from the database. I can't think of a simple logic or way to access only the repeater's items that are on the previous list ...I'm thinking about trying to access each item that's in my database only instead of looping and looping.
I know It's really confusing so I'll just put it in a more illustrative way:
Database View
Items
=======================
ID Name
--- -----
1 Banana
2 Apple
3 Strawberry
4 Orange
ShopCart_Items
========================================
ItemID ItemName CartID Value
------- --------- ------- ------
2 Apple 1 1
4 Orange 1 2
2 Apple 2 2
PageView
First the repeater is populated with all the items that I have in my 'Items' table and no boxes check or anything.
Then I choose a specific cart (say cartId = 1) to edit, and here's what I'm really confused on how to do:
Now the repeater will have like 15-20 items, so I need to access just the items that the user choose on the current cart (cartId = 1) that the user want to edit, so he could know what did he choose and start choose new values, check/uncheck CheckBoxes, etc.
I'm sorry for all this long question, but I'm really confused should/can I access each item directly or what logic do you advice me to use ? ..Thanks =)
I believe that you have mix two different entities in a one repeater - an orders and order items.
In my opinion the better approach is to place two repeaters onto the page: the first one for displaying orders and the second one for displaying order items for the selected order. This way you may use simple SqlDataSource controls for both repeaters and add a ControlParameter to the datasource used for retrieving order items depending on current order selection in the first repeater.