Iron Speed Technical Forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
dnelson241

Registered:
Posts: 65
Reply with quote  #1 
I may be over thinking this but I have a multiple select list box(a filter) that I am selecting more than 1 value.  I am trying to create a textbox that shows the multiple values separated with a comma.  Does anyone know how to do this or have some code behind?
Thanks
David


__________________
Thanks,
David

__________________
Thanks,
David
TrucMi

Registered:
Posts: 220
Reply with quote  #2 

OK, I did something like this on my Edit/Add page not in the Filters though but you may get an idea how to implement this for your need.

To test my approach you will need the followings:

1) "My_DLL" is the ID of my Dropdownlist
Set the AutoPostback to True enter the similar code shown below
Uncheck the SaveInto for this DDL because we don't want to save its selected value

2) "Team" is the Textbox to hold the selected values from the above DDL
Make sure this field is bound to the actual Data field that hold the selected Data from the DDL.  I placed this Textbox right next to the DDL.

Code for my dropdownlist (Make sure to set the Autopostback to True), the code below will check to see if the Textbox has any Data if it does then insert a ; in between when user select a value in the DDL.  That's it.

My_DDL_SelectedIndexChanged

If Me.Team.Text = "" Then 
 Me.Team.Text = Me.My_DDL.SelectedValue
Else
 Me.Team.Text = Me.Team.Text +";"+ Me.My_DDL.SelectedValue
End If


snow

Registered:
Posts: 19
Reply with quote  #3 
You can loop through the listbox and check if each item is selected. If so, concatenate it to the textbox string.

Dim i as integer
Dim str as string
str = ""
For i = 0 To listbox.Items.Count - 1
  If listbox.Items(i).Selected Then
     str = str + listbox.Items(i).Text + ", "
  end if
next

textbox.text = str

'you may need to get rid of the last comma
Hope this helps.

__________________
Present is a gift.
dnelson241

Registered:
Posts: 65
Reply with quote  #4 
snow, that is what I tried and I did get that to work..but I can not figure out a way to finalize what I am trying to do.  Now that I have a textbox....I can't figure out how to pass that to Crystal Reports as a parameter....it is not a database field value, thus I can't pass as a parameter.....basically what I am trying to do is....

Use a multiple select list box and pass all those values selected to a parameter in Crystal Reports?
I would like to multiple select items from a list box(drop down filter) and pass all selected values to a single parameter field in Crystal.  So if I select 4, 5, and 6 from the list box....in crystal I would have a field displaying 4,5,6

Any input would be greatly appreciated.

David


__________________
Thanks,
David
jimatqsi

Registered:
Posts: 62
Reply with quote  #5 
David, I would just create a table for the purpose of providing parameters to the C/R. I normally have a RuntimeParameters_tbl in my app that includes a couple of dates, strings, integers and doubles so it's flexible enough to provide parameters for many different needs.

I have a key for program ID and task, but in a web app you'd need to add one for user. If you need a key by session that could be a challenge on the report side.

Jim
mprindiville

Registered:
Posts: 22
Reply with quote  #6 
Where would this go in the code?  I'm using C# so I  assume mine would look something like this.

int i;
string 
str;
str "";
for 
(i 0(i 
            <
(listbox.Items.Count - 1))i++) {
    
if (listbox.Items(i).Selected) {
        str 
(str 
                    + (listbox.Items(i).Text + 
", "));
    
}
    
}

Would it go in the SelectedIndexChanged() code method?

Quote:
Originally Posted by snow
You can loop through the listbox and check if each item is selected. If so, concatenate it to the textbox string.

Dim i as integer
Dim str as string
str = ""
For i = 0 To listbox.Items.Count - 1
  If listbox.Items(i).Selected Then
     str = str + listbox.Items(i).Text + ", "
  end if
next

textbox.text = str

'you may need to get rid of the last comma
Hope this helps.
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