Hi folks,
I have a WebGrid set up with a WebCombo as a cell editor so that a user can select a value from the drop down to populate the cell value. I have type ahead set up on the WC and it has been working well.
If you try and type a value that is not in the drop down list, when you click out of the cell it simply blanks the value. Is it possible to modify the WG/WC behaviour to allow a value to be selected from the drop down and also allow a user to type in a value.
I realise what i'm askin kind of goes against having the drop down in the first place but if this can be done it would be very helpful.
I appreciate any help.
Thanks.Jonny
Hi,
Here is the solution for editable webcombo in web grid.
function
webcombo_EditKeyUp(webComboId){
hdnOSObj.value = OSCombo.getDisplayValue();
}
webgrid_AfterExitEditModeHandler(gridName, cellId){
cell.setValue(hdnOSObj.value);
webgrid_BeforeExitEditModeHandler(gridName, cellId){
hdnOSObj.value=OSCombo.getDisplayValue();
Regards,
Kireet
Hi Jonny,
You may have solved this already or not longer need a solution but I thought I would post this solution for others anyway.
I needed the same functionality, mostly becasue my web combo is using an AJAX call to populate but only on drop down and therefore the combo may not have any rows when the user enters a value.
Here's how I did it, all clientside java script:
1. create a global variable var txt = ""2. On edit key key up of the web combo: function webcombo_EditKeyUp(webComboId){ txt = document.getElementById("webcombo_input").value; }3. On After Exit Edit Mode of the web grid: function webgrid_AfterExitEditModeHandler(gridName, cellId){
var col = igtbl_getColumnById(cellId); if (col.Key == "webcombocolumn") {
var cell = igtbl_getCellById(cellId);
cell.setValue(txt); }
Thats it. Hope it gives you what you need.
Lloyd
I am trying to use a combo box on a WebGrid so that I can have the benefit of adding new values to existing items.
I am using a free ComboBox control for ASP.NET from MetaBuilders http://www.metabuilders.com/ and I can successfully populate a ComboBox outside of a webgrid. How can I use a combo box on a column of the webgrid?
This is what I have attempted so far (following the way to add a WebMaskedEdit control) but failed to work.
1) Declared a instance of the ComboBox
Protected WithEvents cboHomeOfRecord As New MetaBuilders.WebControls.ComboBox
2) In the IntializeLayout event, added the ComboBox to the Web Form:
If Not pForm1 Is Nothing Then
With cboHomeOfRecord
.Enabled = True
.Visible = True
.ID = "cboHomeOfRecord"
End With
pForm1.Controls.Add(cboHomeOfRecord)
End If
3) In the IntializeLayout event, added the ComboBox to the Web Form:
cboHomeOfRecord.DataSource = (some function that returns an arryalist of objects)
cboHomeOfRecord.DataMember =(Some field name )
Note: a combo box control outside of a webgrid has been successfully populated by the same code as above, so I know the data source is correct
4) In IntializeLayout event, tied the ComboBox to a column of the Grid:
.HeaderText = "Home of Record"
.Type = ColumnType.Custom
.EditorControlID = "cboHomeOfRecord"
Any advice is much appreciated.
Yes, Helen is correct, I was simply asking how you would like this to work, We have been looking at this problem for a while and trying to figure out the best solution to it, but as I described above, there is more complexity to it than at first glance, so I wanted to get your feedback on how you would envision the grid supporting this scenario.
Sorry for the confusion.
Devin
Devin is the ASP.NET product manager. I think he was asking you how you would want the feature to work if it was implemented.
The problem is that the WebCombo won't go into editable mode if it's bound to the grid so it's not possible to even allow the customers to enter new values.