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 -> .NET

 Setting Parameter of Listbox Data Source in Grid

Print topic Send  topic

Author Message
swilson


Posts: 84
Posted: 10/18/2005, 4:43 PM

Can someone please explain the correct way to assign a Where Parameter of the Data Source for a Listbox on a grid?

I need to limit the records displayed by the Listbox to a matching record item, SBN (a textbox) on the same grid row.

Here is the error I get:
SBList.aspx.vb(163) : error BC30451: Name 'SBN' is not declared.
Aircraft_SBPDFFiles_SEB_SData.Expr220 = TextParameter.GetParam(SBN, CObj(1))

This seems a similar issue to my Forum Topic: Using a variable in sql query
Stan had a sucessful solution for the Record Form, but applying that technique to the Grid results in not declared errors. (Which I admit, I cannot solve with my experience and knowledge thus far).

What I have done to set a Where parameter thus far is:
I cliked the ... for Data Source of the Listbox, then cliked the + button, set Condition Type:Parameter, Field Name: SBN (from the drop-down populated by my data source selection), Type: Text, Condition: Equals, Parameter Source: SBN (And I tried {SBN} and Aircraft_SBPDFFiles_SEB_SSBN.Text), Type: Expression, Use Default: 1.

I cannot solve this on my own.

My language is .net vb THANKS!
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message
swilson


Posts: 84
Posted: 10/19/2005, 7:08 AM

I have endlessly searched the forum, web, KB, etc, and still cannot solve this. Here is perhaps a better description of my need:

How can I use a listbox in a grid when the listbox has a data source of another table with a Where parameter from the grid row. In other words, I want to limit the displayed items in the listbox that pertain only to the record displayed in each individual row.

Specifically, my grid displays service bulletins, row-by-row that apply to an aircraft that is specified by a url parameter. Each Service Bulletin has two or three records that pertain to it. These are in another table and I want to reference each of these records per Service Bulletin in each row of the grid.

I know there are other options, but the listbox is the method that would work perfectly in this application.

Please show me an example or how can I do this?

THANKS!
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message
swilson


Posts: 84
Posted: 10/29/2005, 9:13 PM

With the help of Support, here's how I solved it:

Before Show of Listbox, I added the code:

SBN_ACSNPDFListBox.Items.Clear()  
SBN_ACSNPDFListBox.Items.Add(new ListItem("View Bulletin", 0))  
Dim PDFFileDataCommand As SqlCommand=new SqlCommand("SELECT * " & "FROM SBPDFFiles " & "WHERE SBID = "&DataItem.PartsCost.Value,Settings.IDPCessnaDataAccessObject)  
Dim ListBoxSource As DataRowCollection=PDFFileDataCommand.Execute().Tables(0).Rows  
Dim j As Integer  
For j=0 To ListBoxSource.Count-1   
Dim Val As String = (New TextField("", ListBoxSource(j)("PDFFile"))).GetFormattedValue("")  
SBN_ACSNPDFListBox.Items.Add(new ListItem(Val, Val))  
Next

I loaded the same value for both the key and text of the listbox items since I needed to pass this same selected item value to an open window javascript in the HTML. Here's how:

On Change of the listbox, added code:
//Custom Code @52-2A29BDB7  
    // -------------------------  
window.open('/IDPCessna/SEBFiles/'+this.value);  
    // -------------------------  
//End Custom Code

This resulted in a limited list box for each grid row that was populated with selectable links to a pdf pop-up. Slick.
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
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.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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