﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebCombo - WebCombo 4 OnInitialize ClientSideEvents Property Not Rendered</title><link>http://www.intersoftsolutions.com/Community/WebCombo/WebCombo-4-OnInitialize-ClientSideEvents-Property-Not-Rendered/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>WebCombo 4 OnInitialize ClientSideEvents Property Not Rendered</title><link>http://www.intersoftsolutions.com/Community/WebCombo/WebCombo-4-OnInitialize-ClientSideEvents-Property-Not-Rendered/</link><pubDate>Mon, 11 Jan 2010 02:34:41 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;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?&lt;/p&gt;
&lt;p&gt;Actually, i don;t quite sure why in your sample onInitialize event is not being called. &lt;br /&gt;Therefore, I need a simple working sample for you to help me to investigate the issue. &lt;br /&gt;But as far i know, although the event is being called, setvalue from client side event would not make Combo box is being preselected. &lt;br /&gt;If you selected items based on Value, you only can do at server side.&lt;br /&gt;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).  &lt;br /&gt;&lt;br /&gt;e.g &lt;i&gt;WebCombo1.SetText("ALFKI",true);&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>WebCombo 4 OnInitialize ClientSideEvents Property Not Rendered</title><link>http://www.intersoftsolutions.com/Community/WebCombo/WebCombo-4-OnInitialize-ClientSideEvents-Property-Not-Rendered/</link><pubDate>Fri, 08 Jan 2010 10:00:06 GMT</pubDate><dc:creator>PRISMAY</dc:creator><description>&lt;p&gt;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 &lt;a href="http://www.intersoftpt.com/Community/WebCombo/WebCombo-4-Client-Calls-SetSelectedIndex-And-SetSelectedRowByValue-Fail-Crash/" target="_blank"&gt;here&lt;/a&gt; as it's the same control.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;I currently have it in the combo's prerender per this code&lt;/p&gt;&lt;pre&gt;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);
}
&lt;/pre&gt;
&lt;p&gt;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.&lt;/p&gt;&lt;pre&gt;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&amp;#43;&amp;#43;];
    var itemIndex = arguments[idx&amp;#43;&amp;#43;];
    var itemValue = arguments[idx&amp;#43;&amp;#43;];
    var itemText = arguments[idx&amp;#43;&amp;#43;];
    
    // get the ClientIds object
    var oIds = GetClientIds(containerId);
    if (!jsg_PrismUtility.IsVo(oIds))
    {
        return false;
    }

    oIsCbo.SelectedIndex = itemIndex;
    oIsCbo.SetValue(itemValue);
    oIsCbo.SetTextBoxValue(itemText);
}
&lt;/pre&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;</description></item></channel></rss>