Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataBinding Problem

Status
Not open for further replies.

JOBARAM

Programmer
May 25, 2002
52
IL
Hi,
I need to bind 3 prices ('Data' column values)to 3 text boxes.
I have the following table:

product Type Data
1111 1 22.30
1111 2 32.70
1111 3 40.00

To Add the Data_Type table I use:
dataSet.Tables.Add(Obj_DataType.GetSelect("1111"));

(Obj_DataType.GetSelect("1111")) - Runs a select SP that returns 3 records.

using the following will get me only the first price (22.30)

txtPrice1.DataBindings.Add("Text", dataSet, "Data_Type.Data");

How do i bind the other Data values into the rest of the text boxes?

txtPrice2.Text - ????
txtPrice3.Text - ????

Thanks
 
The form will only bind to one record at a time. You will have to write code to cycle throught he records and set the Textbox.Text values manually if you want different records to be displayed on one form.
 
Yes it does bind to one row only.
I tried the following:

DataView dv1 = new DataView();
dv1.Table = dataSet.Tables["Data_Type];

dv1.AllowDelete = true;
dv1.AllowEdit = true;
dv1.AllowNew = true;
dv1.RowFilter = " Data_type = '1'";
dv1.RowStateFilter = DataViewRowState.OriginalRows;
dv1.Sort = "Data";
txtPrice1.DataBindings.Add("Text", dv1, "Data");

I get empty text in the controls.
Why can't I Use the DataView? it should be perfect for me.

Thanks again
Yossi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top