Hi, I wonder if someone can point me in the right direction..
I have a webcombo dropdown which I am using to display a grid, I have Type Ahead set to extended and all works well. My issue is as follows, I am using this webcombo to select a particular client and wanted to populate other controls on the same page dependant on which client is selected. My problem comes on how to select the client I am currently highlighted on. I didn;t want a button next to the webcombo to select it and post back, so was hoping that I could either use the enter key to select the client that is currently highlighted, or the mouse click on the grid to post back to the server and populate accordingly.
What is the best/easiest way of doing this?
Hope it all makes sense
Many thanks
Richard
You'll want to add an event handler for the selectedrowchange event of the webcombo. I think the behavior you're looking for is demontrated in the AgentManagement sample included with the product. Check out this link for the online version of that app. Click in the textbox and type in "ad" and then select an agent from the list. https://ko.infragistics.com/samples/aspnet/data-grid/application-styling
-Tony
Hi Tony
Many thanks for your reply, I had tried the onrowchange server event before but this is fired as the name suggests on every row change. Rather I would like to navigate the record set with arrow keys until I select the record I want, then press carriage return to fire the event. (I also would like to use the mouse to click as well which works at the moment obviously) I wonder if I can cancel postbacks on the client side (will check) if the key press is not carriage return?
If you have any further pointer would be grateful
Regards
I have the same problem, the only difference is that I want to select the row typing in the webcombo, using an Editable WebCombo. The SelectedRowChanged event is fired after press the first key, I want to use the enter key to fire the event, or click outside the webcombo.
So I think is the same problem of Richard
Thank in advance
Johni Ecco
In this case you'll want to NOT connect the selectedrowchange event, and instead have a separate submit button which is used to trigger your update. You can use the client-side BeforeCloseUp event which will fire after the user clicked on a value, hit the enter key, or clicked outside of the combo - or you can use the EditKeyDown, and look for an enter key press.
Tony,
I have tried to use the BeforeCloseUp event, like you said, but the method isn't fired after i hit the enter key and even after click outside the combo. The method is fired only when the dropdown is closed (clicking in the arrow).
I don't want to use a button to fire the event so my problem persists.
The webcombo don't have a method to do or cancel postbacks like the webgrid have igtbl_cancelPostBack(grid); ?
Cheers,
Hi Richard,
I think your code came incomplete and unformatted, but like you said, great minds think alike. With your idea i have solved my problem. Now the user can select the row by typing inside the webcombo and fire the event just when the user press enter, tab, or clicking in a row. Below i provide the full code i used:
.aspx code
<script id="igClientScript" type="text/javascript"><!--
//With this function, the event is fired after the user select an item by clicking in a rowfunction wcCompany_BeforeCloseUp(webComboId){ wcCompany_EditKeyDown(webComboId,0,13);}function wcCompany_EditKeyDown(webComboId,newValue,keyCode){ //if user press enter or tab if (keyCode == 13 || keyCode == 9) { var combo = igcmbo_getComboById(webComboId); if (combo.getDataValue() != null) { document.getElementById('<%# hdRowChanged.ClientID %>').value = "1"; //document.forms[0].submit(); var warp = ig$('<%# warpCompany.ClientID %>'); if(!warp) return; combo.setDisplayValue(combo.getValue()); warp.refresh(); } } else document.getElementById('<%# hdRowChanged.ClientID %>').value = "0";}--></script>
<igmisc:WebAsyncRefreshPanel ID="warpCompany" runat="server" Width="100%" Height="100%" > <asp:HiddenField ID="hdRowChanged" runat="server" Value="0" /> <igcmbo:WebCombo ID="wcCompany" runat="server" Editable="True" > <ClientSideEvents EditKeyDown="wcCompany_EditKeyDown" BeforeCloseUp="wcCompany_BeforeCloseUp" /> </igcmbo:WebCombo></igmisc:WebAsyncRefreshPanel>
In the .cs file:
protected void Page_Load(object sender, System.EventArgs e){ if (hdRowChanged.Value == "1" && wcCompany.SelectedRow!=null) { wcCompany_SelectedRowChanged(wcCompany, null); }}
protected void wcCompany_SelectedRowChanged(object sender, Infragistics.WebUI.WebCombo.SelectedRowChangedEventArgs e){ this.populateDept();}
As you can see i'm using a WebAsyncRefreshPanel, so i used the js code to refresh the panel, but the code you provide to submit the form works too.
Thanks for the idea