hi i hv problem in how to get below in a grid form (no binding i need to hard core it where field name are store in string)
having drop down in each cell....like there should be 4 row(as 4 field name ..it will increase if field name increases) and 4 column...its not binding but general...i need to put in 1st column under fieldname as emp_id then in next row emp_name all 4 should be drop down and for each cell user should be allowed to pick from list...and so on.. same is true for display order .... i am using your ultragrid to do thid but i could not get as wht to do and how to hv 4 rows with four column with out binding...ultragrid..and how to add 1-4 nos to dropdown list...so it will allow user to select from list at each row... Field name Display Order Sort Order Sort Emp_ID 2 3 desc EMP_NAme 1 2 EMP_Add 3 1 EMP_PERMENANT 4 4
how to hv header as Field name , Display name ,Sort order and sort for 4 column and then under each group ....how to hv values like under field name how to group emp_id......emp_permenant...and each cell should hv drop down so that user can selcet from lise...if in 1st column 1 row user select for emp_id then in next row he should hv only three option to select and so on.....
Normal 0 false false false MicrosoftInternetExplorer4
Field name
Display Order
Sort Order
Sort
Emp_ID
2
3
desc
EMP_NAme
1
EMP_Add
EMP_PERMENANT
4
Hi,
Okay, I'm still not sure I understand exactly what you want to do here. But this is a start, I think.
There is no built-in functionality in the grid to automatically keep the values in a column unique. And this is really not an easy thing to do in a bound data source, anyway.
But if you have a relatively small number of rows, then this should be possible with a little bit of creative coding.
So let's say you have 4 rows in your grid and you have a column which is numbered from 1 to 4, with a dropdown list in it. So suppose my grid looks like this:
What I would do in this case is use an UltraDropDown control as the ValueList for your column. The UltraDropDown is like a dropdown grid, and as such, it has to be bound, just like the WinGrid. But the advantage of the UltraDropDown over a regular ValueList, is that the UltraDropDown allows you to hide or disable items on the list.
So you could use a single UltraDropDown for the entire column - you don't need one for every cell. And then you could handle an event of the grid to hide or disable the items on the list that are not allowed for any particular grid row. You could use a number of events for this. I would probably use the BeforeCellListDropDown event of the grid. This even fires before the user drops down the list, so it's a good place to make adjustments to the list.
You could examine the grid's ActiveCell and gets it's current value, then loop through the items in the dropdown and set Hidden or Activation on each row however you like.
This is also a good place to store the original value of the cell. Then you can use AfterCellListCloseUp and check the new value of the cell and see if it changed. In fact, I think you will have to use the Text property of the cell rather than the Value here, since Value will not have been updated at the time this event fires. Or, you could use AfterCellUpdate, in which case, you could use the Value.
Either way, once you compare the values, you could loop through the rows in the grid and update each one based on what happened in the current row. Of course, you will need to skip the current cell that the user edited.
hello sir,
Thx for ur reply.
..i have set dropdownlist for all cells of 2nd column like 1 to 4 numbers..but when user will select 1st number from the list then how only remaining 3 list of numbers will appear in next cells..and so on..also i want pushup/pushdown approach suppose i increase the display number i.e. from say 4 to 1 then 1 will become 2, 2 will become 3,3 will become 4 and 4 will become 1 i.e. the others will get pushed down (pushup/pushdown)
FrmSort.NWindData.DataArray(1, 2) = "1"FrmSort.NWindData.DataArray(2, 2) = "2"FrmSort.NWindData.DataArray(3, 2) = "3"FrmSort.NWindData.DataArray(4, 2) = "4"
Private Sub Form_Activate() InitForm MyArray.AttachArray NWindData Set Adaptor.Object = MyArray Set ugColumnData.DataSource = Adaptor ugColumnData.Bands(0).Columns(1).Style = ssStyleDropDownList ugColumnData.Bands(0).Columns(1).ValueList = oPositionList ugColumnData.Bands(0).Columns(2).Style = ssStyleDropDownList ugColumnData.Bands(0).Columns(2).ValueList = oPositionList End Sub
Private Sub InitForm()Dim i As IntegerSet oPositionList = Me.ugColumnData.ValueLists.Add("ID_PositionList")oPositionList.ValueListItems.ClearFor i = 1 To NWindData.RowCount oPositionList.ValueListItems.Add iNextEnd Sub
with above code in each and every cell i am getting all the numbers list i.e 1,2,3,4 but i want as how to filterout number when user will select perticular number in perticular cell and in next cell only remaining list should appear...and not all the list........
suppose i increase the display number i.e. from say 4 to 1 then 1 will become 2, 2 will become 3,3 will become 4 and 4 will become 1 i.e. the others will get pushed down (pushup/pushdown)
i hope u fot my point
Which part of this are you having trouble with? You seem to be asking a wide range of questions here and I'm not sure I can answer all of them without more specifics.
The grid requires a data source, so you have to bind it to something. But you don't need a database. You could use the grid's QuickStart or the Start button to set up the data source using an UltraDataSource and define the columns and rows you want.