Using Profile variable for query

D

DanWeaver

I am assigning a profile variable based on the conents of a text box
when a button is pressed- this is then used as a search term to
populate a list box- all controls are in same ajax update panel- how
can I update the profile variable before the listbox gets populated -
ie assign the variable prior to the sql call (as the sql query should
use the variable). I am trying to do this using the VS bind
configuration wizard with a few modifications. I dont really want to
have to manually bind in code other than the simple kind below.

1) user term eg "car" provided in text box
2) button pressed
3) set profilevariable = textbox.text
4) make sql call (select model where type like profilevariable)
4) listboxcar populate.

any help appreciated. d
 
G

Guest

Howdy,

If you use SqlDataSource to bind the data (or any data bound source
controls) There you may specify values vua selectparamjeters collection.
There are many different types of parameters, but in your case have a look at
ProfileParameter and ControlParameter.

it would be great to see some code from you to see what exactly you're
trying to achieve.

Regards
 
D

DanWeaver

Sorry for delay in response Milosz, thanks for your reply. I am trying
to use Vis Studio to bind a listbox based on a text box input so eg
user puts "Ferrari" in text box- I want to return him all makes
beginning with F, so I have a string cutting operation which gets the
first letter- this (F) then becomes the input for my SQL
query ....like F%.... The problem is that I am not too good yet with
writing all these connection strings etc (using the wizards in vis
studio) -am binding the listbox to the correct part of the table and
using- as you suggested- a profile parameter which holds (in my
example F)- the operation is started when user pushes a button, but at
moment not working- first time list box full of errors, on postback
(when the user has entered a value) still no result. How can I set the
profile parameter BEFORE the listbox updates itself?

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,294
Latest member
LandonPigo

Latest Threads

Top