iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I have a control that has a WebCombo object within it. The combo's preselected item is not getting set for whatever reason, i.e., when rendered on the client, it's blank rather than the item value set is selected. The server-side code confirms that the value is being set. This is an unbound combo box and the details of this are in the thread here as it's the same control.
Since the preselection of the item I need wasn't working, I decided to try doing it via client side javascript. I assigned what I needed to OnInitialize but nothing happens and the source of the page shows my method nowhere to be found. I've tried putting the code below in both the custom control's OnPreRender and the combo's PreRender events but nothing.
I currently have it in the combo's prerender per this code
void m_ComboboxRangeType_PreRender(object sender,EventArgs e) { ((PrismComboBox)sender).LayoutSettings.ClientSideEvents.OnInitialize = "jsg_PrismDateRange.DateRangeTypeInit('$controlId','$containerId',$itemIndex,'$itemValue','$itemText');". Replace("$controlId",m_ComboboxRangeType.ClientID). Replace("$containerId",this.ClientID). Replace("$itemIndex",m_ComboboxRangeType.SelectedIndex.ToString()). Replace("$itemValue",m_ComboboxRangeType.SelectedText). Replace("$itemText",m_ComboboxRangeType.Value); }
The javascript function looks like this. I kept the same signature as documented for OnInitialize and retrieved the extra parameters via the arguments collection. Right now it never gets hit so it's not doing anything.
function DateRangeTypeInit(controlId) { // the control is InterSofts so use ISGetObject var oIsCbo = ISGetObject(oIds.cboDateRangeTypeId); if (!jsg_PrismUtility.IsVo(oIsCbo)) { return false; } var idx = 1; var containerId = arguments[idx++]; var itemIndex = arguments[idx++]; var itemValue = arguments[idx++]; var itemText = arguments[idx++]; // get the ClientIds object var oIds = GetClientIds(containerId); if (!jsg_PrismUtility.IsVo(oIds)) { return false; } oIsCbo.SelectedIndex = itemIndex; oIsCbo.SetValue(itemValue); oIsCbo.SetTextBoxValue(itemText); }
I went ahead and put the OnInitialize assignment, for now, in both OnPreRender and the combo's PreRender just to show you the debug value in the attached flash video.
I mainly don't understand why the default value set on the combo box isn't being preselected. I really shouldn't have to do all this workaround work. Thanks.
Hello,
Please correct me if I am wrong in getting your point. You showed that the parameter collections you sent from server into OnIntialize are correct. The only issue that it seems onInitializeEvent is not called or after you set WebCombo value and it was not being preselected, correct?
Actually, i don;t quite sure why in your sample onInitialize event is not being called. Therefore, I need a simple working sample for you to help me to investigate the issue. But as far i know, although the event is being called, setvalue from client side event would not make Combo box is being preselected. If you selected items based on Value, you only can do at server side.Otherwise if you want to do it at client side, you will have to use SetText, not SetValue(SetValue does not make selected item on WebCombo). e.g WebCombo1.SetText("ALFKI",true);
Regards,Handy
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname