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 ?
Related
I have a DropDownList that is filled with data from a database table, in this case, a description.
On the Website it is attached to, the user selects a description and hits a button. The process will then find the matching description in the table and import all of the relevant data for display. This method works perfectly.
However, If instead, I fill the text with the description, and the value with the ItemCode, when I try to have the code use SelectedItem(assuming is used the text field), it will shunt the selection to the topmost of the similar items. for example, a "2x4x12 Pine" and a "2x4x12 Spruce".
The primary key of the table uses ItemCode(2x4x12) and type(pine or spruce). this means that while the description of the two items are different, but the value is the same. could this be why it is shunting the selection to the top of the similar items?
While typing this out I may have rubberduckied the problem.
My best guess is that because multiple items use the same item code, resulting in the same value for multiple fields, that the DDL is selecting the item by value and not text, and this results in the selection being shunted to the top option in a grouping that has the dame value.
I am new in asp.net so may be this is the foolish question I am going to ask but I am suffering from it. I am making a application in which firstly user fill all the details such as country state and city when submit the application it shows preview. The problem comes when in Edit operation all other data is retrieved along with all elements drop down list shows only the retrieved value ...I want to show the retrieved value as selected with the others value as well in the list... because if user wants to change his/her selected value then how will he/ she change the value...
I am using drop-down list.items.add to show the retrieved value from the database ...
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.
Please refer to the image. I have a bunch of textboxes and labels (activity and dates - as shown in the image). I have to store the value of the labels (both activity name and column name) and the value that is entered by the user in the text box when the submit button below the table is clicked (not visible in picture).
I have given a unique ID to each row but I don't know how to make use of it to store values. I am just asking what approach to take here. I can post the code but that wouldn't be of much use as I couldn't understand how to store values.
I have a local database, which holds records for cars, it has fields ID(ai, primary), plateNumber, Comments, ect..
Also I have a form with ListBox, button "Checked", and many text fields.
I am using winforms, and every time I run the application, constructor retrieves all the records from the db which have the bool field named "checked" == null, and displays the carnumbers in the Listview. When a specific plateNumber in that listBox is clicked, the other column data for the selected carPlate should appear in the textfields, but the
Problem is that there might be more records with the same plateNumber where "Checked" == null(true otherwise).
Question: how to keep the information about the specific plate number "behind the scenes" and when person clicks to select the platenumber from the listBox, it displays the data about the current(by id) platenumber in the form. Note that, if person clicks a "Checked" button on the form, it stores "TRUE" in the DB "checked" field and removes the specific carPlate from the listBox, and the next time application is launched it won't display that specific ID. In web I use hidden fields with javascript to achieve this, in C# I'm not aware how you keep information like that, I'm leaning towards arrays?
Thanks.
ListViews are populated with ListViewItems. The ListViewItem class has a Tag property, where you can store anything you want. Your "hidden" or "behind the scenes" data can be stored there.