I have an unbound WebCombo. I am trying to get the Key value within the cells collection.
For instance I have:
Key='A' Text='Administrator'
When I view this in client side code The DisplayValue and DataValue are both = 'Administrator' . I need the Key value of 'A'
Robert
Hi,
I am not clear your question, but i think you are asking about the ascii code. If you are asking about this then use the below code in WebCombo keypress event
var key=event.KeyCode;
Regards,
Kannan.S
Actually I was asking how to get the Key or the "Datavalue" of the selected index of the combo. Both the text value and the data value where always the same value when binding to an SqlDataSource:the Textvalue
This behavior is a bug in Infragistics using the Designer and Row edit templates. I order to fix this You need to bind a datatable to a combo such as:
Dim dtPRIV As New Data.DataTable("PRIV")
dtPRIV.Columns.Add("Priv", GetType(String))dtPRIV.Columns.Add("Priv_Key", GetType(String))dtPRIV.Rows.Add(New Object() {"Administrator", "A"})dtPRIV.Rows.Add(New Object() {"Super User", "S"})dtPRIV.Rows.Add(New Object() {"User", "U"})
Me.wc_PRIV.DataSource = dtPRIVMe.wc_PRIV.DataTextField = "Priv"Me.wc_PRIV.DataValueField = "Priv_Key"Me.wc_PRIV.Width = Unit.Pixel(160)Me.wc_PRIV.DropDownLayout.FrameStyle.Height = Unit.Pixel(70)Me.wc_PRIV.DropDownLayout.FrameStyle.Width = Unit.Pixel(137)Me.wc_PRIV.DropDownLayout.DropdownHeight = Unit.Pixel(70)Me.wc_PRIV.DropDownLayout.DropdownWidth = Unit.Pixel(137)Me.wc_PRIV.DataBind()Me.wc_PRIV.Columns(0).Width = Unit.Pixel(110)Me.wc_PRIV.Columns(0).Header.Caption = "User Privilege"Me.wc_PRIV.Columns(1).Width = Unit.Pixel(0)Me.wc_PRIV.Columns(1).Hidden = TrueMe.wc_PRIV.SelectedIndex = 2
Please use the following code to resolve the problem.
var cmb=igcmbo_getComboById("WebCombo1");
Since ypu are using KeyFiled as second column in the webcombo you can use the follow code
var cmbvalue=cmb.getGrid().getActiveRow().getcell(1).getValue();
We cannot use webcombo.getValue() or webcombo.getDataValue() because from Infragistics ver 8.2 the DataTextFiled and DataValueFiled must be same otherwise it returns the Webcombo displayvalue not the datavalue. So i also resolve that problem useing the above code.