Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
barry_

Registered:
Posts: 5
Reply with quote  #1 
For quick selector, it will by default insert a 'Please select' list item, and that is the default selected when quick selector loads. I know how to remove the addition of that, simply by commenting out the code where its added in the Set() function. However I am having trouble, getting it to select the first value the quick selector list.

Now I know about using "MiscUtils.ResetSelectedItem(this.quickSelector, new ListItem(fvalue, cvalue));" to set the quick selector manually.

But is there a way to tell it to just select the first item in the quick selector list?

e.g.


Say i have a quick selector with 3 items, 'A', 'B', 'C'. I just want to display first item, in this case 'A' at Index 0.

MiscUtils.ResetSelectedItem(this.quickSelector, Index[0]);
scrimej

Avatar / Picture

MVP Developer
Registered:
Posts: 236
Reply with quote  #2 
There are no list elements in a quick selector.  The control is populated with a single value.  Then when you click the control you launch the corresponding QuickSelector form that shows the list of available values.  Selecting one still only populates the quickselector with a single value.  

If you need the functionality you describe you'll have to use a dropdownlist which populates the list when the form loads.
barry_

Registered:
Posts: 5
Reply with quote  #3 
Okay thanks scrimej.
herimo

Registered:
Posts: 2
Reply with quote  #4 
In version 12.2 (12.2.0.14965 64 Bit) I was able to accomplish this using the property sheet for the Add form.  

Assuming that your values are read from a database table - I set the "Initialize when adding record" to the Primary Key Value of the item to be selected.  
You can verify by looking at the generated code for the Set() method.  This method will have code similar to the snippet shown below:

// Default Value could also be NULL.

if (this.DataSource != null && this.DataSource.IsCreated)

{

 selectedValue = this.DataSource.InspectorGUID.ToString();

 }

else

{

 selectedValue = EvaluateFormula("\"ID_VALUE_GOES_HERE\"");

}

JimiJ

Avatar / Picture

MVP Developer
Registered:
Posts: 1,950
Reply with quote  #5 
Quote:
Originally Posted by barry_


... However I am having trouble, getting it to select the first value the quick selector list.



I used to write a code to obtain this but the simplest, though not very elegant is to drop a hidden DDL bound to the same column as with the QS. Then we can insert in the alike code junction as Herimo's. You must also set MaxgeneratedItems = 1 on the hidden DDL to avoid loading unnecessary list. 

// Default Value could also be NULL.

if (this.DataSource != null && this.DataSource.IsCreated)

{

 selectedValue = this.DataSource.InspectorGUID.ToString();

 }

else

{

 // This is the code:
 this.HiddenDDL.SelectedIndex = 1;
 selectedValue = this.HiddenDDL.SelectedValue;

}

Jimi J

__________________

  Jaime Jegonia
[jts_logo]

Iron Speed MVP Developer
 

". . . and whoever sows generously will also reap generously" 2 Cor 9:6

Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement