Dropdownlist misbehavior

I have to ask same question again.
I have a Hero DataGrid where I am trying to implement a Dropdownlist as a custom renderer for a column.
A listener is used to update Grid's data when something has been selected in the Dropdown:
addEventListener("change", onDataChange);
protected function onDataChange(event:Event):void
     Grid(owner).selectedItem[column.dataField] = selectedItem[column.dataField];
The problem is when I select an item by clicking on it it takes another click to close the dropdown part. That will trigger the change event again which I could have managed but two clicks I cannot.
Commenting out
//Grid(owner). ....
will fix the problem but how I can update Grid's dataProvider in this case?
Any idea, please?
BTW, if I drop the control down with a mouse then use keyboard to navigate to an item and enter to select it that is no problem at all.
I have added the following code:
var dde:DropDownEvent = new DropDownEvent(DropDownEvent.CLOSE, false, true);
dde.preventDefault();
dispatchEvent(dde);
That I have borrowed from the SDK. Still does not work!!!!!!!! So, how many programmers does it take to close Dropdown????
Thanks
Message was edited by: Zolotoj
Message was edited by: Zolotoj

Hi,
It seems like that you were doing program with C#, if so, I would like to suggest you post in the C# forum:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral
Regards,
Yan Li
Regards, Yan Li

Similar Messages

  • How can I display True/False in my dropdownlist as "Yes" and "No"?

    Hi All,
    I want to bind a dropdownlist to a boolean value (so it's either true or false).  I'm particularly interested in using two-way binding to when the user changes from "yes" to "no" the boolean value automatically changes from "true" to "false."  But, I want the user to see "yes" and "no" as the options, rather than "true" and "false".
    How can I display "yes" and "no" and still take advantage of binding?  Or can I not use binding in this circumstance?
      -Josh

    Solution 1:
    In order to display Yes/No for True/False, you may specify labelFunction for the dropdownList.
    In MXML:
    <s:DropDownList labelFunction="myLabelFunction" />
    In actionscript:
    private var arr:ArrayCollection = new ArrayCollection(["true","false"]);
                private function mylabelFunction(item:Object):String
                    if(item.toString() == "true")
                        return "yes";
                    else return "No";
    OR
    Solution2:
    may be u can try making an array collection like
    private var arr:ArrayCollection = new ArrayCollection([{label:"yes",value:"true"},{label:"no",value:"false"}]);
    and specify labelField for the dropdownList like
    <s:DropDownList labelField="label" dataProvider="{arr}" />

  • How do I read txt file and add items to dropdownlist or checkbox

    I want to add items to a dropdown or check box by reading from a text file(and select one of them). (I donot use any table or database). The list of items is sometimes upto 20MB and hence cannot populate using session bean.I want items to be added to either checkbox or listbox during a button action. I have done this for textarea but unable so far to acheive for checkbox or listbox. I use following code which does not work:
    public String button3_action() {       
    try{           
    FileReader fr = new FileReader "F:/CreatorProjects/checkboxtst.prs");
    BufferedReader br = new BufferedReader(fr);
    String s;
    while((s=br.readLine())!=null) {
    dropdown1.setValue(s);
    br.close();
    fr.close();
    }catch(Exception e) {
    e.printStackTrace();
    return null;
    I know I cant just transplant textarea code for dropdownlist or checkbox.
    Any help is greatly appreciated.
    Thanks.
    Dr.AM.Mohan Rao

    I am able to read from txt file to a listbox if i write in sessionsbean1:
    try{
    FileReader fr = new FileReader("F:/CreatorProjects/checkboxtst.prs");
    BufferedReader br = new BufferedReader(fr);
    String s1="";
    String s="";
    while((s=br.readLine())!=null) {
    s1 = s1+s;
    s1= s1+"\n";
    disOptions = new com.sun.rave.web.ui.model.Option[] {              
    new Option(s1,s1)};
    diseases = new String[] {};
    fr.close();
    br.close();
    catch(Exception e) {
    e.printStackTrace();
    But I get all data in one line!! if I click submit button text area gets all. How to display items in each line????Please help...
    Dr.AM. Mohan Rao

  • How do I get a web part to display items from a dropdownlist?

    I have a DropDownList that am filling with items from a list. The part of my code that am using to read the list and populating the drop down works just fine. I am now trying to figure out how to display the contents of the drop down on a web part. I know
    it sounds like a straight forward and easy thing to figure out, but I have blanked out. Does anyone have a snippet I can take a look at? This is how I am currently reading from a list to create the drop down...
    protected override void CreateChildControls()
    string title = string.Empty;
    EditorChoices = new DropDownList();
    string siteUrl = "mySite";
    using (SPSite site = new SPSite(siteUrl))
    SPWeb web = site.RootWeb;
    SPList list = web.Lists["testList"];
    SPQuery testQuery = new SPQuery();
    testQuery.Query = "<Query><Where><Geq><FieldRef Name='Title'/>" +
    "<Value Type='Number'>10</Value></Geq></Where></Query>";
    foreach (SPListItem item in list.GetItems(testQuery))
    title = Convert.ToString(item["Title"]);
    EditorChoices.Items.Add(title);
    Controls.Add(EditorChoices);
    base.CreateChildControls();
    ChildControlsCreated = true;
    I basically want to display the items returned from the query, which are now in the dropdownlist, to be displayed on my custom webpart. I really appreciate the help.
    Thanks
    UPDATE: My dropdownlist is a web part property. So when editing the web part, the drop down control appears in the web part property. Now that part is working just fine. The part am having an issue with is, the second part of my requirement is that I want
    to display that same information within the drop down on the web part. Not as another drop down, but just to display them as a vertical text list on the web part.

    Hello,
    >I want to be able to display all the entteries in the dropdown,
    Could you please provide more information? as per your description fisrt part is done, which was filling data in dropdown list. So what is next?
    If you want to get selected value from dropdown or filter value then you may try this link:
    http://bilbrobloggins.com/sharepoint/dropdown-list-box-filter-web-part-in-sharepoint-ndash-part-three/
    http://tmullenssharepoint.wordpress.com/2013/04/12/sharepoint-custom-web-part-properties-from-sharepoint-list/
    Correct me if i misunderstood
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Extend spark dropdownlist button to the longest item in dataprovider ?

    Hi,
    simple as stated in the thread's title : I cannot figure out a way to have my spark DropDownLists (no particular skin) extend their width to their longest item width ??
    For instance the following :
    <s:DropDownList id="aglist" width="100%" requireSelection="false"
                                    dataProvider="{model.userAssignedAgents}" labelFunction="agentLabel"
                                    change="aglist_changeHandler(event)" open="{aglist.selectedIndex = -1}"/>
    when layed on a simple spark panel gets the standard DDList button width, about 50px whatever its content, though its items are much longer than that. So when the button is clicked, the dropdown menu shows some ugly scrollbars.
    Do you have any clue ? I've been stuck for hours trying to do what sounds like the very-standard-way-of-setting-dropdownlist-width to me !
    Thanks
    Matt

    Good point.
    The main problem I had with the ComboBox is that I don't want to allow "creation" of new elements, so if the typed text doesn't match any element, instead of selectedIndex of -3 it should just keep the old selection. Plus a few other things.
    Thinking about it, this is probably my best choice, and if I were to extend a class it should probably be this one.

  • Relationship between a Spark DropDownList's dataProvider and selectedItem

    I'm working on an existing project and have come across a somewhat complicated issue regarding a Spark DropDownList's (actually, a custom component inheriting from it) displayed item not changing when its dataProvider is updated.
    Here's the code for the custom TitleWindow component containing the custom DropDownList:
    <?xml version="1.0" encoding="utf-8"?>
    <components:RFTitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                              xmlns:s="library://ns.adobe.com/flex/spark"
                              xmlns:mx="library://ns.adobe.com/flex/mx"
                              xmlns:components="components.*"
                              xmlns:rfform="rfform.*"
                              width="550" height="450"
                              title="{currentState} Site Equipment"
                              cancelButton="{btnCancel}"
                              defaultButton="{btnSave}"
                              initialFocus="{rftName}"
                              creationComplete="init()" close="cancelEdit()">
      <fx:Script>
        <![CDATA[
          import events.SiteEquipmentEvent;
          import events.SiteEquipmentTypeEvent;
          import mx.collections.ArrayList;
          import mx.controls.Menu;
          import mx.core.FlexGlobals;
          import mx.core.UIComponent;
          import mx.events.MenuEvent;
          import mx.managers.PopUpManager;
          import mx.validators.ValidationResult;
          import mx.validators.Validator;
          import spark.events.IndexChangeEvent;
          private const TYPES:Array = ["A", "B", "C", "D"];
          [Bindable] [Embed(source="../assets/images/circle_red_x.gif")] private var icoRedX:Class;
          [Bindable] private var siteEquipment:SiteEquipment;
          private var validators:Array;
          private var typePopUp:Menu;
          public static function open(item:SiteEquipment):SiteEquipmentEdit
            var s:SiteEquipmentEdit = new SiteEquipmentEdit();
            s.siteEquipment = item;
            PopUpManager.addPopUp(s, DisplayObject(FlexGlobals.topLevelApplication), true);
            PopUpManager.centerPopUp(s);
            return s;
          private function init():void
            initTypePopUp();
            if (siteEquipment.id == SiteEquipment.NEW_ID)
              currentState = "New";
            else
              currentState = "Edit";
              validateAll();
              if (!rftName.enabled)
                rfcmbType.setFocus();
            siteEquipment.addEventListener(SiteEquipmentEvent.SITE_EQUIPMENT_SAVE, saveComplete);
          override public function dispose(event:Event = null):void
            super.dispose();
            siteEquipment.removeEventListener(SiteEquipmentEvent.SITE_EQUIPMENT_SAVE, saveComplete);
            typePopUp.removeEventListener("itemClick", typePopUp_click);
            siteEquipment.dispose();
            icoRedX = null;
            siteEquipment = null;
            validators = null;
            typePopUp = null;
            removeChildren();
          private function cancelEdit():void
            siteEquipment.cancelEdit();
          private function saveForm():void
            var newValue:SiteEquipment = new SiteEquipment();
            newValue.id = siteEquipment.id;
            newValue.locid = siteEquipment.locid;
            newValue.name = rftName.trimmedText;
            siteEquipment.save(newValue);
          private function saveComplete(event:Event):void
            dispose();
          private function typePopUp_click(event:MenuEvent):void
            switch(event.item)
              case "Edit Selected Type":
                SiteEquipmentType(rfcmbType.selectedItem).showEditForm();
                break;
              case "Create A New Type":
                new SiteEquipmentType().showEditForm(type_created, null, type_removeListeners);
                break;
          private function type_created(event:SiteEquipmentTypeEvent = null):void
            type_removeListeners(event);
            rfcmbType.selectedItem = event.siteEquipmentType;
          private function type_removeListeners(event:Event):void
            var s:SiteEquipmentType = SiteEquipmentType(event.target);
            s.removeEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, type_created);
            s.removeEventListener(SiteEquipmentType.SITE_EQUIPMENT_TYPE_CANCEL, type_removeListeners);
          private function initTypePopUp():void
            typePopUp = Menu.createMenu(puType, ['Edit Selected Type', 'Create A New Type']);
            typePopUp.addEventListener("itemClick", typePopUp_click);
          private function popupTypeOptions():void
            var p:Point = puType.localToGlobal(new Point(0, puType.height + 5));
            typePopUp.show(p.x, p.y);
          private function validateAll():void
            var isValid:Boolean;
            for each (var validator:Validator in validators)
              isValid = true;
              for each (var result:ValidationResult in validator.validate().results)
                if (result.isError)
                  isValid = false;
                  break;
              UIComponent(validator.source).styleName = "valid_" + isValid.toString();
          private function rfcmbType_changeHandler(event:IndexChangeEvent):void
            if (TYPES.indexOf(SiteEquipmentType(RFDropDownList(event.target).selectedItem).name) > -1)
              rftName.text = "Blah";
              rftName.enabled = false;
            else
              rftName.enabled = true;
        ]]>
      </fx:Script>
      <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <s:DateTimeFormatter id="mdy"
                             dateTimePattern="MM/dd/yyyy"/>
      </fx:Declarations>
      <components:states>
        <s:State name="Edit"/>
        <s:State name="New"/>
      </components:states>
      <rfform:RFForm width="100%" height="100%"
                     saveButton="{btnSave}"
                     validators="{new ArrayList([valQuantity, valHeight])}">
        <rfform:RFFormItem label="Type"
                           width="100%">
          <s:HGroup width="100%">
            <rfform:RFDropDownList id="rfcmbType"
                                   width="100%"
                                   originalValue="{siteEquipment.model.eqType}"
                                   dataProvider="{SiteEquipmentType.all}"
                                   change="rfcmbType_changeHandler(event)"/>
            <rfform:RFButton id="puType"
                             icon="@Embed(source='/Shared/src/assets/images/settings.png')"
                             width="30"
                             click="popupTypeOptions()"/>
          </s:HGroup>
        </rfform:RFFormItem>
      </rfform:RFForm>
    </components:RFTitleWindow>
    I've omitted a little bit of code, so please ask if you need anything that I didn't include.
    In regards to the RFDropDownList, originalValue is saved so that when a new selection is made, the new selection can be compared to the original value.  Setting originalValue sets the RFDropDownList's selectedItem to originalValue.
    When this window is first opened, a new instance of SiteEquipment is created.  Unless the equipment is new, the SiteEquipment instance sets the SiteEquipmentType to whatever has already been saved, using this line:
    eqType = SiteEquipmentType.selectFromObject(item.SITE_EQUIPMENT_TYPE);
    And here's the code from the SiteEquipmentType class:
    package components
      import common.UpdateStatus;
      import events.SiteEquipmentTypeEvent;
      import scripts.MyUtility;
      import flash.events.Event;
      import flash.events.EventDispatcher;
      import flash.utils.setTimeout;
      import mx.collections.ArrayCollection;
      import mx.collections.Sort;
      import mx.collections.SortField;
      import mx.controls.Alert;
      import mx.rpc.events.ResultEvent;
      import mx.utils.ObjectProxy;
      [Event(name="cacheChanged", type="flash.events.Event")]
      [Event(name="SITE_EQUIPMENT_TYPE_CREATE", type="events.SiteEquipmentTypeEvent")]
      [Event(name="SITE_EQUIPMENT_TYPE_EDIT", type="events.SiteEquipmentTypeEvent")]
      [Event(name="SITE_EQUIPMENT_TYPE_CANCEL", type="flash.events.Event")]
      public class SiteEquipmentType extends ObjectProxy
        public static const NEW_ID:int = -1;
        public static const SITE_EQUIPMENT_TYPE_CANCEL:String = "siteEquipmentTypeCancel";
        [Bindable]
        public var id:int = NEW_ID;
        [DefaultProperty]
        [Bindable]
        public var name:String = "";
        private static var dict:Object = new Object();
        private static var getAllServiceCalled:Boolean = false;
        private static var eventDispatcher:EventDispatcher = new EventDispatcher();
        private var updateStatus:UpdateStatus = UpdateStatus.COMPLETE;
        public function SiteEquipmentType(item:Object = null, keepInCache:Boolean = true)
          if (item == null)
            return;
          else if (item is int)
            id = int(item);
            refreshFromDb();
          else
            updateFromResult(item);
          if (keepInCache)
            addToCache(this);
        private static var _all:ArrayCollection = new ArrayCollection();
        public static function get all():ArrayCollection
          if (!getAllServiceCalled)
            getAllServiceCalled = true;
            MyUtility.httpPost("/page.aspx", {request:"SITE_EQUIPMENT_TYPE"}, getAll_result);
            var s:Sort = new Sort();
            s.fields = [new SortField("name", true)];
            _all.sort = s;
          return _all;
        public static function addEventListener(type:String, listener:Function):void
          eventDispatcher.addEventListener(type, listener);
        public static function removeEventListener(type:String, listener:Function):void
          eventDispatcher.removeEventListener(type, listener);
        public static function dispatchEvent(event:Event):Boolean
          return eventDispatcher.dispatchEvent(event);
        private static function addToCache(item:SiteEquipmentType):void
          removeFromCache(item.id);
          dict[item.id] = item;
          _all.addItem(item);
          dispatchEvent(new Event("cacheChanged"));
        private static function removeFromCache(id:int):void
          var item:SiteEquipmentType = dict[id];
          if (item)
            delete dict[id];
            _all.removeItemAt(_all.getItemIndex(item));
        public static function selectById(id:int):SiteEquipmentType
          if (dict[id])
            return dict[id];
          return new SiteEquipmentType(id);
        public static function selectFromObject(obj:Object):SiteEquipmentType
          var selected:SiteEquipmentType;
          var objId:int = obj.SITE_EQUIPMENT_TYPE_ID;
          if (dict[objId])
            selected = dict[objId];
            selected.updateFromResult(obj);
          else
            selected = new SiteEquipmentType(obj);
          return selected;
        private function updateFromResult(item:Object):void
          if (item)
            id = item.SITE_EQUIPMENT_TYPE_ID;
            name = item.SITE_EQUIPMENT_TYPE_NAME;
        private function toRequestObject():Object
          var o:Object = new Object();
          o.SITE_EQUIPMENT_TYPE_ID = id;
          o.SITE_EQUIPMENT_TYPE_NAME = name;
          return o;
        public function copy():SiteEquipmentType
          return new SiteEquipmentType(this.toRequestObject());
        public function save(value:SiteEquipmentType):void
          if (updateStatus == UpdateStatus.PENDING)
            Alert.show("Site Equipment Type is pending an update.", "Pending Update");
            return;
          else if (updateStatus == UpdateStatus.ERROR)
            Alert.show("There is a problem with this Site Equipment Type, and it cannot be saved. Please close the window.", "Save Failure");
            return;
          var request:Object;
          if (id == NEW_ID)
            if (value)
              request = value.toRequestObject();
            else
              request = toRequestObject();
            request._COMMAND = "INSERT";
          else
            if (value)
              request = MyUtility.objectDiff(this.toRequestObject(), value.toRequestObject());
              if (!request)
                dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, this));
                return;
            else
              request = toRequestObject();
            request._COMMAND = "UPDATE";
            request._SITE_EQUIPMENT_TYPE_ID = id;
          delete request.SITE_EQUIPMENT_TYPE_ID;
          updateStatus = UpdateStatus.PENDING;
          MyUtility.httpPost("/updatetable.aspx?_SCHEMA=dbo&_TABLENAME=SITE_EQUIPMENT_TYPE&_RETURNRECORD=1", request, httpSave_result);
        public function toString():String
          return name;
        public function refreshFromDb():void
          if (updateStatus != UpdateStatus.PENDING)
            updateStatus = UpdateStatus.PENDING;
            MyUtility.httpPost("/page.aspx", {id:id, request:"Site_Equipment_Type"}, httpSelect_result);
        public function showEditForm(onCreate:Function = null, onEdit:Function = null, onCancel:Function = null):void
          if (id == 0)
            Alert.show("Edits are not allowed on this Site Equipment Type.", "Not Allowed");
            return;
          if (onCreate != null)
            addEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, onCreate);
          if (onEdit != null)
            addEventListener(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, onEdit);
          if (onCancel != null)
            addEventListener(SITE_EQUIPMENT_TYPE_CANCEL, onCancel);
          if (updateStatus == UpdateStatus.PENDING)
            setTimeout(showEditForm, 500);
          else if (updateStatus == UpdateStatus.COMPLETE)
            SiteEquipmentTypeEdit.open(this);
        public function cancelEdit():void
          dispatchEvent(new Event(SITE_EQUIPMENT_TYPE_CANCEL));
        private static function getAll_result(event:ResultEvent):void
          if (event.result.ROOT)
            if (event.result.ROOT.ERROR)
              Alert.show(event.result.ROOT.ERROR, "Error");
            else
              for each (var o:Object in MyUtility.ToArrayCollection(event.result.ROOT.SITE_EQUIPMENT_TYPE))
                var i:SiteEquipmentType = dict[o.SITE_EQUIPMENT_TYPE_ID];
                // If the Site Equipment Type is already in the cache, update it based on the XML returned
                if (i)
                  i.updateFromResult(o);
                  // Otherwise, create a new one from the XML returned
                else
                  i = new SiteEquipmentType(o);
              _all.refresh();
        private function httpSelect_result(event:ResultEvent):void
          if (event.result.ROOT)
            if (event.result.ROOT.ERROR)
              Alert.show(event.result.ROOT.ERROR, "Error");
              updateStatus = UpdateStatus.ERROR;
            else
              updateFromResult(event.result.ROOT.SITE_EQUIPMENT_TYPE);
              updateStatus = UpdateStatus.COMPLETE;
          else
            updateStatus = UpdateStatus.ERROR;
        private function httpSave_result(event:ResultEvent):void
          if (event.result.ROOT.ERROR)
            Alert.show(event.result.ROOT.ERROR, "Error");
            updateStatus = UpdateStatus.ERROR;
          else
            try
              updateStatus = UpdateStatus.COMPLETE;
              if (id == NEW_ID)
                id = event.result.ROOT.RESULTS.IDENTITY;
                addToCache(this);
                updateFromResult(event.result.ROOT["DBO.SITE_EQUIPMENT_TYPE"]);
                dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_CREATE, this));
              else
                updateFromResult(event.result.ROOT["DBO.SITE_EQUIPMENT_TYPE"]);
                dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, this));
                SiteEquipmentType.dispatchEvent(new SiteEquipmentTypeEvent(SiteEquipmentTypeEvent.SITE_EQUIPMENT_TYPE_EDIT, this));
            catch(ex:Error)
              Alert.show(ex.message, "Error");
              updateStatus = UpdateStatus.ERROR;
    So the "_all" ArrayCollection serves as a cache of all of the different site equipment types.  When the edit window is first opened and a new instance of SiteEquipment is created, the SiteEquipmentType of the current SiteEquipment is added to _all and becomes the only SiteEquipmentType within _all.
    At this point, the DropDownList has the correct item selected.  The problem occurs when the result comes in from getting all of the SiteEquipmentTypes.  The contents of _all are flushed, and each SiteEquipmentType is added in.  Once this happens, the DropDownList will have nothing for selectedItem.
    I know this is quite complex, but any help would be greatly appreciated.

    Ok, I have this figured out now.  First, though, I'll point out that this worked fine when using MX components and the Halo theme; the problem only appeared after switching over to Spark components and the Spark theme.  Anyway, since this class functions as a singleton (as best I understand them), I added a boolean variable to the SiteEquipmentType class representing whether or not the results from the HTTPService call had come back and been inserted into _all.  So in the TitleWindow's init method, I only populated the DropDownList's originalValue (which in turn sets the selectedItem) if that variable is true.  The first time an instance of the TitleWindow component is opened, though, this variable will initially be false.  So back in the SiteEquipmentType class, I have it dispatch an event right after setting the variable to true, and the TitleWindow componet will add a listener for this event if the variable is originally false.  If anyone needs further explanation, please ask.

  • How to get textbox text inside Repeater based on specific row dropdownlist selection using JavaScript

    Hi All,
    I have dropdownlist and textbox controls inside repeater control. Suppose when i select specific dropdownlist i want get the value of selected item and mean while i want to get the textbox text which in the same row.
    <script type="text/javascript">
    var ddlType;
    function ddl(ddl) {
    ddlType = ddl.value;
    alert(ddlType);
    </script>
    <asp:Repeater ID="RepterDetails" runat="server"
    onitemdatabound="RepterDetails_ItemDataBound"
    onitemcommand="RepterDetails_ItemCommand" >
    <ItemTemplate>
    <tr>
    <td>
    <asp:DropDownList ID="ddlTypeName" runat="server" onchange="ddl(this)"></asp:DropDownList>
    </td>
    <td>
    <asp:TextBox ID="txtCode" runat="server" Text='<%#Eval("otaRoomTypeCode") %>' />
    </td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>
    Using the javascript i got the selected dropdownlist selected value, how to get the textbox text which is in the same row.
    Please give me advice and please find the repeater control screenshot.
    Thanking You, Nagendra.

    This forum if for C# issues, please move your post to asp.net forum:  http://forums.asp.net/
    Thanks
    Fouad Roumieh

  • How can I create a dynamic Dropdownlist

    Hi Experts,
    I am new in the adobe forms and I have this problem.
    I am working on a Dropdownlist in Adobe Interactive Form. In my case, my form will be used in Offline-ABAP system without any web dynpro application.
    I have an internal table containing some values like this (number of rows depend on what is store on the database dynamic)
    A0  Dropdownlist1
    A1    Dropdownlist2
    A2    Dropdownlist2
    B0 Dropdownlist1
    B1    Dropdownlist2
    B2    Dropdownlist2
    B3    Dropdownlist2
    B4    Dropdownlist2
    C0  Dropdownlist1
    C5    Dropdownlist2
    C6    Dropdownlist2
    C7    Dropdownlist2
    I would like to create 2 dropdownlist. to be as follows:
    The first dropdownlist must have for example the values A0, B0, C0 .
    When the user select for example B0 from the Dropdownlist1, then dropdownlist2 must have only the value B1, B2, B3 and B4.
    How can i do that as I have seen the example in the purchase order (country and state).
    My requirement is that, the value must be dynamic, that means i must select the value from the SAP-Database into internal table and bind it to my dropdownlist.
    Thanks and Regards.
    mishak

    See the following program, it builds a dynamic internal table based on the company codes from the select option. 
    report zrich_0001 .
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    data: it001 type table of t001 with header line.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_bukrs for it001-bukrs.
    selection-screen end of block b1.
    start-of-selection.
      select * into table it001 from t001
                     where bukrs in s_bukrs.
      perform build_dyn_itab.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = 'PERIOD' .
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      append wa_it_fldcat to it_fldcat .
      loop at it001.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = it001-bukrs .
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 4.
        append wa_it_fldcat to it_fldcat .
      endloop.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    Regards,
    Rich Heilman

  • Hide / unhide dropdownlist in DateTime Picker

    I am writing an ASP.NET application and using javascript DateTime Picker code (I have found it on the Internet):
    <script type="text/javascript">
    // <!-- <![CDATA[
    // Code begin...
    // Set the initial date.
    var ds_i_date = new Date();
    ds_c_month = ds_i_date.getMonth() + 1;
    ds_c_year = ds_i_date.getFullYear();
    // Get Element By Id
    function ds_getel(id) {
        return document.getElementById(id);
    // Get the left and the top of the element.
    function ds_getleft(el) {
        var tmp = el.offsetLeft;
        el = el.offsetParent
        while(el) {
            tmp += el.offsetLeft;
            el = el.offsetParent;
        return tmp;
    function ds_gettop(el) {
        var tmp = el.offsetTop;
        el = el.offsetParent
        while(el) {
            tmp += el.offsetTop;
            el = el.offsetParent;
        return tmp;
    // Output Element
    var ds_oe = ds_getel('ds_calclass');
    // Container
    var ds_ce = ds_getel('ds_conclass');
    // Output Buffering
    var ds_ob = '';
    function ds_ob_clean() {
        ds_ob = '';
    function ds_ob_flush() {
        ds_oe.innerHTML = ds_ob;
        ds_ob_clean();
    function ds_echo(t) {
        ds_ob += t;
    var ds_element; // Text Element...
    var ds_monthnames = [
    'Jan', 'Feb', 'Mars', 'Apr', 'Mai', 'Jun',
    'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'
    ]; // You can translate it for your language.
    var ds_daynames = [
    'Sun', 'Man', 'Tue', 'Wen', 'Thu', 'Fri', 'Sat'
    ]; // You can translate it for your language.
    // Calendar template
    function ds_template_main_above(t) {
        return '<table cellpadding="3" cellspacing="1" class="ds_tbl">'
             + '<tr>'
             + '<td class="ds_head" style="cursor: pointer" onclick="ds_py();"><<</td>'
             + '<td class="ds_head" style="cursor: pointer" onclick="ds_pm();"><</td>'
             + '<td class="ds_head" style="cursor: pointer" onclick="ds_hi();" colspan="3">[Close]</td>'
             + '<td class="ds_head" style="cursor: pointer" onclick="ds_nm();">></td>'
             + '<td class="ds_head" style="cursor: pointer" onclick="ds_ny();">>></td>'
             + '</tr>'
             + '<tr>'
             + '<td colspan="7" class="ds_head">' + t + '</td>'
             + '</tr>'
             + '<tr>';
    function ds_template_day_row(t) {
        return '<td class="ds_subhead">' + t + '</td>';
        // Define width in CSS, XHTML 1.0 Strict doesn't have width property for it.
    function ds_template_new_week() {
        return '</tr><tr>';
    function ds_template_blank_cell(colspan) {
        return '<td colspan="' + colspan + '"></td>'
    function ds_template_day(d, m, y) {
        return '<td class="ds_cell" onclick="ds_onclick(' + d + ',' + m + ',' + y + ')">' + d + '</td>';
        // Define width the day row.
    function ds_template_main_below() {
        return '</tr>'
             + '</table>';
    // This one draws calendar...
    function ds_draw_calendar(m, y) {
        // First clean the output buffer.
        ds_ob_clean();
        // Here we go, do the header
        ds_echo (ds_template_main_above(ds_monthnames[m - 1] + ' ' + y));
        for (i = 0; i < 7; i ++) {
            ds_echo (ds_template_day_row(ds_daynames));
    // Make a date object.
    var ds_dc_date = new Date();
    ds_dc_date.setMonth(m - 1);
    ds_dc_date.setFullYear(y);
    ds_dc_date.setDate(1);
    if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    days = 31;
    } else if (m == 4 || m == 6 || m == 9 || m == 11) {
    days = 30;
    } else {
    days = (y % 4 == 0) ? 29 : 28;
    var first_day = ds_dc_date.getDay();
    var first_loop = 1;
    // Start the first week
    ds_echo (ds_template_new_week());
    // If sunday is not the first day of the month, make a blank cell...
    if (first_day != 0) {
    ds_echo (ds_template_blank_cell(first_day));
    var j = first_day;
    for (i = 0; i < days; i ++) {
    // Today is sunday, make a new week.
    // If this sunday is the first day of the month,
    // we've made a new row for you already.
    if (j == 0 && !first_loop) {
    // New week!!
    ds_echo (ds_template_new_week());
    // Make a row of that day!
    ds_echo (ds_template_day(i + 1, m, y));
    // This is not first loop anymore...
    first_loop = 0;
    // What is the next day?
    j ++;
    j %= 7;
    // Do the footer
    ds_echo (ds_template_main_below());
    // And let's display..
    ds_ob_flush();
    // Scroll it into view.
    ds_ce.scrollIntoView();
    // A function to show the calendar.
    // When user click on the date, it will set the content of t.
    function ds_sh(t) {
    document.form1.dropDownList.display = false; //this line not working
    // Set the element to set...
    ds_element = t;
    // Make a new date, and set the current month and year.
    var ds_sh_date = new Date();
    ds_c_month = ds_sh_date.getMonth() + 1;
    ds_c_year = ds_sh_date.getFullYear();
    // Draw the calendar
    ds_draw_calendar(ds_c_month, ds_c_year);
    // To change the position properly, we must show it first.
    ds_ce.style.display = '';
    // Move the calendar container!
    the_left = ds_getleft(t);
    the_top = ds_gettop(t) + t.offsetHeight;
    ds_ce.style.left = the_left + 'px';
    ds_ce.style.top = the_top + 'px';
    // Scroll it into view.
    ds_ce.scrollIntoView();
    // Hide the calendar.
    function ds_hi() {
    ds_ce.style.display = 'none';
    document.form1.dropDownList.display = true; //this line not working
    // Moves to the next month...
    function ds_nm() {
    // Increase the current month.
    ds_c_month ++;
    // We have passed December, let's go to the next year.
    // Increase the current year, and set the current month to January.
    if (ds_c_month > 12) {
    ds_c_month = 1;
    ds_c_year++;
    // Redraw the calendar.
    ds_draw_calendar(ds_c_month, ds_c_year);
    // Moves to the previous month...
    function ds_pm() {
    ds_c_month = ds_c_month - 1; // Can't use dash-dash here, it will make the page invalid.
    // We have passed January, let's go back to the previous year.
    // Decrease the current year, and set the current month to December.
    if (ds_c_month < 1) {
    ds_c_month = 12;
    ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid.
    // Redraw the calendar.
    ds_draw_calendar(ds_c_month, ds_c_year);
    // Moves to the next year...
    function ds_ny() {
    // Increase the current year.
    ds_c_year++;
    // Redraw the calendar.
    ds_draw_calendar(ds_c_month, ds_c_year);
    // Moves to the previous year...
    function ds_py() {
    // Decrease the current year.
    ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid.
    // Redraw the calendar.
    ds_draw_calendar(ds_c_month, ds_c_year);
    // Format the date to output.
    function ds_format_date(d, m, y) {
    // 2 digits month.
    m2 = '00' + m;
    m2 = m2.substr(m2.length - 2);
    // 2 digits day.
    d2 = '00' + d;
    d2 = d2.substr(d2.length - 2);
    // DD.MM.YYY
    return d2 + '.' + m2 + '.' + y;
    // When the user clicks the day.
    function ds_onclick(d, m, y) {
    // Hide the calendar.
    ds_hi();
    // Set the value of it, if we can.
    if (typeof(ds_element.value) != 'undefined') {
    ds_element.value = ds_format_date(d, m, y);
    // Maybe we want to set the HTML in it.
    } else if (typeof(ds_element.innerHTML) != 'undefined') {
    ds_element.innerHTML = ds_format_date(d, m, y);
    // I don't know how should we display it, just alert it to user.
    } else {
    alert (ds_format_date(d, m, y));
    // And here is the end.
    // ]]> -->
    <!--DateTime Picker code-->
    </script>
    Also I have to use DropDownList below this DateTime Picker. In the IE 6.0 "DropDownList" control comes in front of this calendar (this is a known problem in IE 6.0, that is form items appear infront of all other).
    And now I am trying to hide the form items as the DateTime Picker is shown and display them again as the calendar is closed. For this action I am using:
    document.form1.dropDownList.display = true / false in the "function ds_sh(t)" and "function ds_hi()"
    but its not working (not hide or unhide, no action).
    Maybe somebody could help me in this situation.
    Thanks in advance.
    br,
    Forumaic

    I replaced these to lines that not worked in the DateTime picker with this one:
    var obj = document.getElementById('ddlTest');
        obj.style.visibility = "visible";
    var obj = document.getElementById('ddlTest');
        obj.style.visibility = "hidden";And now everything working like it should be.
    Forumaic.

  • Using a DropDownList in a DataGrid, both with dynamically loaded content

    I just bought FlashBuilder 4.5 and even though I have been using ActionScript for years, I am having the hardest time to solve a seemingly simple task:
    I have a database table with names of employees:
    id
    name
    departmentid
    1
    Janet Jackson
    2
    2
    Frank Zappa
    2
    3
    John Travolta
    1
    in another table I have the departments
    id
    Department
    1
    Acting Department
    2
    Music Department
    What I want is a DataGrid with a DropDownList itemRenderer for the Department so that I can selected the Department by name and not by id. This should be a no-brainer (and with HTML and PHP I have done that hundreds of times), but with Flex I can not figure out how to do this. This is what I have done so far:
    Created the DataGrid, generated the database service and dragged it to the datagrid to bind the data. Works.
    Then I created an itemRenderer for departmentid
    In the department itemRenderer I dragged a DropDownList element, created a database service for the departments and dragged it onto that to get the databinding.
    So far, so good. When I start it, I have a populated datagrid with a DropDownList that shows all available departments when I click on it.
    What I need, of course, is that the Department DropDownList now shows the Department of the Employee row. When I change the Department in the DropDownList, it should update the Employee Database table.
    I literally spend now days on trying to figure this out and can't find anything on the Internet that would help me. If you could give me some advise or even show me how the code needs to look, it would be GREATLY appreciated.
    I am pasting here also the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:employeeservice="services.employeeservice.*"
                      width="982" height="380" minWidth="955" minHeight="600">
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                        getAllEmployeeResult.token = employeeService.getAllEmployee();
              ]]>
         </fx:Script>
         <fx:Declarations>
              <s:CallResponder id="getAllEmployeeResult"/>
              <employeeservice:EmployeeService id="employeeService"
                                                       fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                       showBusyCursor="true"/>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <s:DataGrid id="dataGrid" x="52" y="67" width="455"
                        creationComplete="dataGrid_creationCompleteHandler(event)" editable="true"
                        requestedRowCount="4">
              <s:columns>
                   <s:ArrayList>
                        <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                        <s:GridColumn dataField="firstname" headerText="firstname"></s:GridColumn>
                        <s:GridColumn dataField="lastname" headerText="lastname"></s:GridColumn>
                        <s:GridColumn dataField="departmentid" editable="false" headerText="departmentid"
                                         itemRenderer="components.DepartmentDropDownList"></s:GridColumn>
                   </s:ArrayList>
              </s:columns>
              <s:typicalItem>
                   <fx:Object id="id1" departmentid="departmentid1" firstname="firstname1"
                                lastname="lastname1"></fx:Object>
              </s:typicalItem>
              <s:AsyncListView list="{getAllEmployeeResult.lastResult}"/>
         </s:DataGrid>
    </s:Application>
    Here the code of the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:s="library://ns.adobe.com/flex/spark"
                             xmlns:mx="library://ns.adobe.com/flex/mx"
                             xmlns:departmentservice="services.departmentservice.*"
                             width="172" height="34" clipAndEnableScrolling="true">
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   override public function prepare(hasBeenRecycled:Boolean):void {
                        lblData.text = data[column.dataField]
                   protected function dropDownList_creationCompleteHandler(event:FlexEvent):void
                        getAllDepartmentResult.token = departmentService.getAllDepartment();
              ]]>
         </fx:Script>
         <fx:Declarations>
              <s:CallResponder id="getAllDepartmentResult"/>
              <departmentservice:DepartmentService id="departmentService"
                                                            fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                            showBusyCursor="true"/>
         </fx:Declarations>
         <s:Label id="lblData" top="9" left="7"/>
         <s:DropDownList id="dropDownList" x="34" y="5" width="128"
                             creationComplete="dropDownList_creationCompleteHandler(event)"
                             labelField="department">
              <s:AsyncListView list="{getAllDepartmentResult.lastResult}"/>
         </s:DropDownList>
    </s:GridItemRenderer>

    I just bought FlashBuilder 4.5 and even though I have been using ActionScript for years, I am having the hardest time to solve a seemingly simple task:
    I have a database table with names of employees:
    id
    name
    departmentid
    1
    Janet Jackson
    2
    2
    Frank Zappa
    2
    3
    John Travolta
    1
    in another table I have the departments
    id
    Department
    1
    Acting Department
    2
    Music Department
    What I want is a DataGrid with a DropDownList itemRenderer for the Department so that I can selected the Department by name and not by id. This should be a no-brainer (and with HTML and PHP I have done that hundreds of times), but with Flex I can not figure out how to do this. This is what I have done so far:
    Created the DataGrid, generated the database service and dragged it to the datagrid to bind the data. Works.
    Then I created an itemRenderer for departmentid
    In the department itemRenderer I dragged a DropDownList element, created a database service for the departments and dragged it onto that to get the databinding.
    So far, so good. When I start it, I have a populated datagrid with a DropDownList that shows all available departments when I click on it.
    What I need, of course, is that the Department DropDownList now shows the Department of the Employee row. When I change the Department in the DropDownList, it should update the Employee Database table.
    I literally spend now days on trying to figure this out and can't find anything on the Internet that would help me. If you could give me some advise or even show me how the code needs to look, it would be GREATLY appreciated.
    I am pasting here also the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:employeeservice="services.employeeservice.*"
                      width="982" height="380" minWidth="955" minHeight="600">
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                        getAllEmployeeResult.token = employeeService.getAllEmployee();
              ]]>
         </fx:Script>
         <fx:Declarations>
              <s:CallResponder id="getAllEmployeeResult"/>
              <employeeservice:EmployeeService id="employeeService"
                                                       fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                       showBusyCursor="true"/>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <s:DataGrid id="dataGrid" x="52" y="67" width="455"
                        creationComplete="dataGrid_creationCompleteHandler(event)" editable="true"
                        requestedRowCount="4">
              <s:columns>
                   <s:ArrayList>
                        <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                        <s:GridColumn dataField="firstname" headerText="firstname"></s:GridColumn>
                        <s:GridColumn dataField="lastname" headerText="lastname"></s:GridColumn>
                        <s:GridColumn dataField="departmentid" editable="false" headerText="departmentid"
                                         itemRenderer="components.DepartmentDropDownList"></s:GridColumn>
                   </s:ArrayList>
              </s:columns>
              <s:typicalItem>
                   <fx:Object id="id1" departmentid="departmentid1" firstname="firstname1"
                                lastname="lastname1"></fx:Object>
              </s:typicalItem>
              <s:AsyncListView list="{getAllEmployeeResult.lastResult}"/>
         </s:DataGrid>
    </s:Application>
    Here the code of the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:s="library://ns.adobe.com/flex/spark"
                             xmlns:mx="library://ns.adobe.com/flex/mx"
                             xmlns:departmentservice="services.departmentservice.*"
                             width="172" height="34" clipAndEnableScrolling="true">
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   override public function prepare(hasBeenRecycled:Boolean):void {
                        lblData.text = data[column.dataField]
                   protected function dropDownList_creationCompleteHandler(event:FlexEvent):void
                        getAllDepartmentResult.token = departmentService.getAllDepartment();
              ]]>
         </fx:Script>
         <fx:Declarations>
              <s:CallResponder id="getAllDepartmentResult"/>
              <departmentservice:DepartmentService id="departmentService"
                                                            fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                            showBusyCursor="true"/>
         </fx:Declarations>
         <s:Label id="lblData" top="9" left="7"/>
         <s:DropDownList id="dropDownList" x="34" y="5" width="128"
                             creationComplete="dropDownList_creationCompleteHandler(event)"
                             labelField="department">
              <s:AsyncListView list="{getAllDepartmentResult.lastResult}"/>
         </s:DropDownList>
    </s:GridItemRenderer>

  • Display a message when  an item is selected from a dropdownlist

    Hi,
    I need to display a message(kind of alert message) when certain items are selected from the dropdownlist.
    Let me know what is a good way to do this in web elements?
    Thanks

    hello,
    unfortunately there is no validation / alerting for select menus in webelements.
    however...if you're feeling ambitious and or this is a definite requirement for your project...custom functions are open source so you could write an on change javascript function within the WESelect custom function that will find the new value and compare it against your certain items array of values.
    out of curiosity, what is your project's particular need to have an alert for a select menu based on what the end user selects? if this comes up more often or there's a good use case perhaps this could be built into a future version.
    jw

  • Using a DropDownList to filter data

    I am working on my first aspx/CR that uses controls on the page to filter the displayed data. I have a crystal report that by default pulls all warehouse data. It is comprised of two separate views. I have added a DropDownList to the aspx page to allow the user to select a single warehouse. I have the crystalReportViewer hidden by default and on the SelectedIndexChanged event of the DropDownList, I have the code to set the crystalReportViewer to visible. I have the code in the ConfigureCrystalReports() section to define the selection criteria. My code is as follows:
        private void ConfigureCrystalReports()
            if (!IsPostBack)
                crystalReportViewer.Visible = false;
            else
                string warehouse = ddlWarehouse.SelectedValue;
                string selectFormula = "{VW_CURRENT_INVENTORY_GL.WH}=" + warehouse;
                crystalReportViewer.SelectionFormula = selectFormula;
    <snipped>
        protected void ddlWarehouse_SelectedIndexChanged(object sender, EventArgs e)
            crystalReportViewer.Visible = true;
    The page loads with no errors and the report is hidden, but when I select a valid warehouse, I get this error because it's not capturing the value in the dropdownlist correctly:
    A number, currency amount, boolean, date, time, date-time, or string is expected here. Details: errorKind Error in File CURRINV_GL_NOLOT_PROD {7FCFCEBF-94D6-4DF0-BA8E-816763C625B8}.rpt: Error in formula Record Selection: '{VW_CURRENT_INVENTORY_GL.WH}=Select Warehouse' A number, currency amount, boolean, date, time, date-time, or string is expected here. Details: errorKind
    If I put Response.Write(selectFormula) right after the selectFormula is set, it's not getting the value in the DropDownList - it's keeping the generic "Select Warehouse" which is the default value in the dropdownlist. I tried moving that definition to the SelectedIndexChanged event, but it's not working correctly. I tried adding crystalReportViewer.DataBind() in the selectedindexchanged event but it's still not getting the updated value in the dropdownlist. I need that to fire anytime they change the value in the dropdownlist and then have the report refresh with the new data.

    I got this working right after I submitted this question. I ended up moving the whole selectFormula definition to the SelectedIndexChanged event and it works like a charm.

  • Problem with this version of DropDownLists, there is no removeItem function

    Dear All,
    I have a problem with this new version of the DropDownLists, in previous versions you had the removeItem function and others, but now you just have clearItems and addItem.
    I have a list of elements in which a customer will be able to link and delete any element that he wants, I had selected a DropDownList to do that but considering that the removeItem function is not present I dont know how to do that...
    Does anybody know how to delete a element in a dropdownlist?
    If not, the solution will be to get all the elements in an array and reload the list but without the element "deleted" . Does anybody knows how to get all the elements of a DropDownList?
    Thanks
    Ruben.

    If you have a drop-down list named myDropDownList,with SOMExpression
    Form.page1.myDropDownList then you can remove the
    element at position
    i using the following code:
    var myItems = xfa.form.resolveNode("Form.page1.myDropDownList.#items");
    myItems.nodes.remove(myItems.nodes.item(i));
    Good luck.

  • Condition in 7.0 query not used when mapped to dropdownlist in 3.5 web temp

    Hi Experts
    I have a 7.0 query with a condition so that it only shows topN records for a given KF. The query is shown in a chart in a 3.5 web template and here is the condition working just fine. However in the same web template has I made a dropdownlist which is based on the same query as the chart but here is the condition not used.
    Do you know how I get the system to apply the condition to the dropdownlist as well?
    I have tried to set the "Read mode" to the possible values (posted values, master data table, dimension table) on the dropdownlist element in the 3.5 web template but it didn't help.
    Thanks and kind regards,
    Torben

    No replies... closed...

  • Retrieve list items from the textbox text value and display the dropdownlist item for that particular list item

    hi,
     I have created a custom list in my sharepoint :
    List1 name:   employeedepartment  -
                   Title       empdepartment
                   A             D1
                   B             D2
                   C             D3 
    List2  name:  employeedetails  
     emptitle            empname       empdepartment(lookup) --> from the list "employeedepartment"
       x                     Ram                 D1
       y                     Robert             D2
       z                     Rahim              D3
    My task is to create a custom webpart that will be for searching this employee details by entering emptitle
    For this, i have created a visual webpart using visual studio 2010, my webpart will be like this:
    emptitle  --->  TextBox1                        Button1--> Text property : Search
    empname---> TextBox2
    empdepartment-->  DropDownList1
    For this, i wrote the code as follows:
    protected void Button1_Click(object sender, EventArgs e)
                using (SPSite mysite = new SPSite(SPContext.Current.Site.Url))
                    using (SPWeb myweb = mysite.OpenWeb())
                        SPList mylist = myweb.Lists["employeedetails"];
                        SPQuery query = new SPQuery();
                        query.Query = "<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>" + TextBox1.Text.ToString() + "</Value></Eq></Where>";
                        SPListItemCollection myitems = mylist.GetItems(query);
                        if (myitems.Count > 0)
                            foreach (SPListItem item in myitems)
                                string a1 = Convert.ToString(item["empname"]);
                                string a2 = Convert.ToString(item["empdepartment"]);
                                TextBox2.Text = a1;           // displaying   properly                    
                                //DropDownList3.SelectedIndex = 1;                           
     It is showing the list item in textbox according to the item entered in the textbox1... But I am stuck to show in the dropdown list. 
    Suppose, if i enter X in textbox and click on search, then dropdownlist need to show D1,
                               for Y --> D2 and for Z-> D3... like that.
    What code do i need to write in the button_click to show this... 
    Please don't give any links...i just want code in continuation to my code.

    Hi,
    Since you have got the data you want with the help of SharePoint Object Model, then you can focus on how to populate values and set an option selected in the Drop Down List.
    With the retrieved data, you can populate them into the Drop Down List firstly, then set a specific option selected.
    Here is a link will show how to populate DropDownList control:
    http://www.dotnetfunda.com/articles/show/30/several-ways-to-populate-dropdownlist-controls
    Another link about select an item in DropDownList:
    http://techbrij.com/select-item-aspdotnet-dropdownlist-programmatically
    Best regards
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • How to render a message as soon as page is rendered.

    Hi, My requirement is i want to render a message, as a popup or something, as soon as page is rendered. The thing is I dont have any events for this. Is there any way to do it? Thanks, Lalit. Edited by: 856216 on May 31, 2011 6:49 AM

  • Ios 6 Ipod touch 5th Gen - In-app Purchases Don't work

    Ok i don't know if it is just me but i just recently got my new ipod and i cannot restore any of my in app purchases. such as extra content for jetpack joy ride or angry birds, plants vs zombies and so on. i got to purshase an in app item as usal i p

  • How much stock of iphone 5 will a apple store hold on the day of release.

    How much stock of iphone 5 will a apple store hold on the day of release.

  • Node Information

    Hi, Is there a way to get information on a node in a tree. I have a tree and when I click on a node I want to get the node and tree information. Thanks, Marc.

  • Microphone windows tablet not working

    On my windows based Tablet Elitepad 1000 microphone is not working. In Control panel, sound, recording.. green bars are rising, but still no results when recording sound. Only noise can be heard. There is only one selection when selecting recording d