I'm binding a dataset into a hierarchical web grid. The first band has 6 columns and the 2nd band has 8 columns.
I want to put a dropdown list into Bands[ 1 ].Columns[ 8 ]. I do not know how to do this based on the samples and I would like to set the dropdown list selection based on the data received from the database.
Any help would be appreciated.
HTH
I have this information but I'm sure I'm missing something. So I'm adding this information:
In my InitializeLayout, I have this:
UG1.DisplayLayout.Bands[ 0 ].Columns[ 0 ].Header.Caption = "SSN";
UG1.DisplayLayout.Bands[ 0 ].Columns[ 1 ].Header.Caption = "Full Name";
UG1.DisplayLayout.Bands[ 0 ].Columns[ 2 ].Header.Caption = "Address";
UG1.DisplayLayout.Bands[ 0 ].Columns[ 3 ].Header.Caption = "City";
UG1.DisplayLayout.Bands[ 0 ].Columns[ 4 ].Header.Caption = "State";
UG1.DisplayLayout.Bands[ 0 ].Columns[ 5 ].Header.Caption = "Zip";
UG1.DisplayLayout.Bands[ 0 ].Columns[ 6 ].Header.Caption = "SubTotal";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 0 ].Header.Caption = "SSN";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 1 ].Header.Caption = "Full Name";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 2 ].Header.Caption = "Address";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 3 ].Header.Caption = "City";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 4 ].Header.Caption = "State";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 5 ].Header.Caption = "Zip";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 6 ].Header.Caption = "Amount";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 7 ].Header.Caption = "Money Type";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ].Header.Caption = "Status";
UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ].Type = ColumnType.DropDownList;
UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ].AllowUpdate = AllowUpdate.Yes;
ValueList statusType = UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ].ValueList;
statusType.DataSource = Controller.GetPartyTransactionStatusInfo(); **** this gets the 5 list members to populate the dropdown ***
statusType.DataBind();
UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ].ValueList = statusType;
All I get is a blank UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ]
cyedor said: All I get is a blank UG1.DisplayLayout.Bands[ 1 ].Columns[ 8 ]
In the past, I've solved dropdown problems by checking:
ColumnType is set to dropdownlist.
Column names all match.
For the 2nd bullet point, I'm binding a datatable to the grid. For column[ 8 ], I set the type to a DropDownList.
I then tried to bind all the values in the droplist to a Valuelist and add that to column[ 8 ] as you can see in the code snippet. When I debug, I can see my values in the ValueList (called "statusType" in this example).
Still nothing.
cyedor said:Column names all match.
I was talking about data types, e.g. string to VARCHAR, integer to INT, etc. If the database is returning an INT, your column.DataType should be System.Int32 and your ValueList(n).DataValue must also match.
All of my other columns in the grid display the data.
The only thing that doesn't show is the column where the droplist should appear. This is a hierarchical grid so you have to bind 2 datatables to it.
The 2nd datatable has the datarow that contains "Status". In the datatable, it's defined as a typeof "string" (aIso tried a typeof dropdown). The data in the value list is just a simple value, text per row in the dropdown. Show the text with an associated value.
Everything matches.
I don't see the problem. All I know is that when I've had DropDown column problems, I eventually found a mismatch, either in the data types or the actual data.
Wild guess: Could the values you are putting in your ValueList be blank filled; e.g. CAST('ABC' AS CHAR(5)) returns "ABC ", not "ABC"?
Have you tried, as an intermediate step, populating the valulist in markup (using the designer) and seeing if you can get that to work?
(I've noticed that the Infragistics staff have been participating more in these forums lately. Maybe we'll hear from them. ;-)
How did u resolve it?
Hi,
valuelist is bound to a column, but i want to bind for a cell based on some conditions
With Regards,
Tushar Borhade
Software Programmer
Well, I stopped being thick, and worked it out. On to the next problem (which is getting the thing to actually update!!!)
I'm assuming your EmployeeStatusId is the INT you set in your employee table which you want to set using the dropdown. The next thing you need is a query that returns a translation between your INT values and the text you want in the dropdown, like this:
SELECT [StatusId], [StatusName] + '/' + CAST([StatusId] AS NVARCHAR(999)) AS [DropDownText]FROM [StatusLookupTable]
The confiture your dropdown column like this:
Here is where you lose me. I want to have a grid that shows the "words", a dropdown that contains the "words" but a Value member that contains an Int.
For example, let's say we have a select statement like:
Select LastName, EmployeeStatusLabel, EmployeeStatusID From Employee
Then we hook this up to my UltraGrid.
I want two columns: Employee Name || Employee Status
When someone selects the Employee Status cell, I want a drop down that shows some coded value pairs like Active/1, Inactive/2, etc. etc.
Now, the datatype of the displayed column is string, but the value I want to save is Int. Is this possible?