CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 dynamically modify DataSource of a Listbox (ListOfValues)

Print topic Send  topic

Author Message
leopold

Posts: 5
Posted: 06/10/2008, 6:54 AM

Hi fellows

I have a Grid which contains a Listbox control, in the beforeShowRowEvent of the grid, I tried following code
___________________________________________
dim arrayvalue(5), arraybez(5), i

if f_02_Tab_Aktuelle_Veranst1.tester.Value <> -1 Then
active_status1 = "4"
active_status2 = "Aktivieren"
f_02_Tab_Aktuelle_Veranst1.tester_if.Value = "if"
else
active_status1 = ""
active_status2 = ""
f_02_Tab_Aktuelle_Veranst1.tester_if.Value = "else"
end if

arrayvalue(0) = "0"
arrayvalue(1) = "1"
arrayvalue(2) = "2"
arrayvalue(3) = "3"
arrayvalue(4) = active_status1

arraybez(0) = "---------"
arraybez(1) = "Details"
arraybez(2) = "bearbeiten"
arraybez(3) = f_02_Tab_Aktuelle_Veranst1.RowNumber
arraybez(4) = active_status2

for i=0 to 4
response.Write arraybez(i) & "<br>"
next

'f_02_Tab_Aktuelle_Veranst1.Aktion_box.PopulatingType = ccsJoins

set f_02_Tab_Aktuelle_Veranst1.Aktion_box.DataSource = CCCreateDataSource(dsListOfValues,empty, _
Array(Arrayvalue,arraybez))
_____________________________________________________________

I just list the arrays on screen to see if they changing.......they do.

The problem seems to be the row :
set f_02_Tab_Aktuelle_Veranst1.Aktion_box.DataSource = CCCreateDataSource(dsListOfValues,empty, _
Array(Arrayvalue,arraybez))

the listOfValues is created correctly for the first row but is not changing for the 2,3,n row....so the listOfValues in the listbox is allways the list from the first row of the grid....

hope somebody can help me.....thanks
View profile  Send private message
wkempees


Posts: 1679
Posted: 06/10/2008, 9:08 AM

  
Function Tasks_BeforeShow(Sender)   
    
  Set Tasks.Status.DataSource = CCCreateDataSource(dsListOfValues, Empty, _  
      Array(Array("1","2","3"),Array("High","Normal","Low")))  
  
End Function  
The above code is the CCCreateDatasource helptext in CCS4 ASP.

[edited] it was correct, the problem lies in handling the rownumber.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
leopold

Posts: 5
Posted: 06/10/2008, 1:31 PM

I started actually with the code from CCS but even if I use variables (change "low" to variable) I have the same problem.
I tried array() but getting an error when page is loading (index out of range)

I think the arrays are good because it is working for the the first row and when I display the arrays on screen the values are changing.

Maybe the problem is in the function CCCreateDataSource there is the parameter "empty" and I dont know what it means even if you write "" instead of "empty" it working.

thanks for your answer
View profile  Send private message
wkempees


Posts: 1679
Posted: 06/10/2008, 1:56 PM

Oh man, your problem is not the filling of the listbox.
After reading your post over and over I finally understand what your problem is.
Your list box is filling correctly for GRID row 1, but for every subsequent row you get the same data as for GRID row 1.......
Have to scan the forum for you to find the ASP post that handles this.
Is it a GRID or is it an editableGRID? (I think the latter)

Walter.

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
marcwolf


Posts: 361
Posted: 06/10/2008, 3:59 PM

Hi all
Hope this can help. When an editable grid is displayed all controls on a row are suffixed by an underscore and the number of the row.
To get the value from an alternate control in the row, or to run down a column and do sumations you need to beable to extract the row number from the column.

This is a bit of Javascript code that we use to do this.
   
  
// Get Editable Grid Row from Control  
// Pass Control as object (THIS), returns back string of "_x" where x is row  
function GetRowID(Field1){  
       var fldname = ""; var fldname1 = ""; var fldloc = -1;    
       fldname = Field1.name;     fldloc = fldname.lastIndexOf("_"); // work out the calling field and extract its index  
       if (fldloc <= 0) {return "";}  // Not an Index.. Return a Blank, safe to append to control name  
       else  
       {return fldname.substring(fldloc,fldname.length);} // returns back the '_x' where x is the row  
}  
  

Hope this helps someone
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
leopold

Posts: 5
Posted: 06/12/2008, 7:35 AM

ok, I created a new editable grid.......but still have the same problem, the listofvalues in the box is created for the first grid row correctly but not changing for the following rows.

to marcwolf:
yes in javascript you have to work with the rownumber because it is running on client side.
View profile  Send private message
leopold

Posts: 5
Posted: 06/12/2008, 7:47 AM

to wkempees:

sorry for my bad explanation but you got exactly the point, I searched the forum allready but couldn't find any help
View profile  Send private message
leopold

Posts: 5
Posted: 07/15/2008, 3:07 AM

still have this problem, has somebody any idea. :-/ :-/
View profile  Send private message
Anj

Posts: 13
Posted: 03/06/2009, 9:17 PM

Hi I'm a newbie and having a similar problem where I have an editable grid of audit questions and a listbox with answers that apply to that question.

I just want to show the possible answers in the listbox.

I am feeling a little tortured over it as I still can not find a solution that works and I am not sure how to use the js that was described above.

Any help would be greatly appreciated.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.