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