DataView RowFilter

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I have the following code, which should allow me to only show a certain number of items in a listbox:

DataView dv = new DataView(dataSet1.Tables[ISSUE_TYPE_TABLE], "IssueAreaDesc='" + txt + "'","",DataViewRowState.ModifiedCurrent);
types.DataSource = dv.Table;
types.DisplayMember = "Issue Type";
types.DataMember = "IssueType";
types.ValueMember = "IssueTypeDesc";
types.DataBind();

Instead, my listbox does contain the full table's data. Any idea what might be wrong?

Thanks
Mike
 
Hi Mike,

Hi,

I have the following code, which should allow me to only show a certain number of items in a listbox:

DataView dv = new DataView(dataSet1.Tables[ISSUE_TYPE_TABLE], "IssueAreaDesc='" + txt + "'","",DataViewRowState.ModifiedCurrent);
types.DataSource = dv.Table;

You should bind to dv and not to underlying table. Correct code would be:
types.DataSource = dv;


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com


types.DisplayMember = "Issue Type";
types.DataMember = "IssueType";
types.ValueMember = "IssueTypeDesc";
types.DataBind();

Instead, my listbox does contain the full table's data. Any idea what might be wrong?

Thanks
Mike
 
Back
Top