SqlDatasource filter using formview control
Hi there.
I am a newbie :), and am struggling with a formview problem.
Basically I have created a webform with an SQLDataSource that lists three values, an ID field (integer), URL field (Text) and description field. This is Querying a SQL table called "Images"
I have a FormView (FormView1) on the page, which is bound to another sqlDatasource (table "Pages"), one field of which is an ID field relating to an Image in the Images Table.
I have a List Control within the form view which displays a list of Image Discriptions from the first table, and returns the ID as its selected value.
I also have a gridview with a single ImageField sourced from a third SqlDataSource which is essentially the IMAGES table, filtered by a Listcontrol's selected item, this datasource supplies the actual physical url to the image file associated with a particular ID, that the GridView uses to display the image.
If I use a ListControl OUTSIDE the form view, each time I select an image, it is displayed in the Formview.
However, what I want to do is have the drop down list as a template control within the formview.
When I do this, and try to configure the datasource, I am unable to apply the "WHERE" filter to the SQL, either by using "control" as the templated form control is not displayed in the drop down list, OR by selecting form and enetering something like:
Ctype(Me.FormView1.FindControl("SelectImageListBox "),ListControl.SelectedValue.ToString Where "SelectImageListBox" is the name/ID of the ListBox control within the formview.
Basically I want to access a Formview's templated controls selected value and use it to filter an SqlDataSource
I would be very greatful for any help!
Many Thanks,
Tony:)
|