Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,
I have a data view in my program, and I have added filte to dataview in for loop, when this loop completes it first iteration, then it delete the fiter and add a new filter..This working fine for first iteration but for 2nd iteration it is not working..

The code is as follows:

CSS
DataView dv1;
dv1 = new DataView(records.Tables[2])
int i=1;
while(i<=3)
{

dv1.RowFilter = "teamno=" +i;
reqcls = 0;
// Some functionality with filtered records(i=1,2,3)
................
................
dv1.RowFilter = null;
i++;

}


In first iteration(when i=1) this is working fine, but in the second iteration it is coming out of loop..

Thanks in advance..
Posted
Comments
TryAndSucceed 16-Dec-13 13:27pm    
Debug and see what's the value of i after the first loop.
Gaurav Makwana 17-Dec-13 0:13am    
just see bro its very easy debug your code and see values of i and reqcls and check
2012programmer 26-Dec-13 2:30am    
After filtering how to get the value from dataview..?
dv1.Table.Rows[k]["roomno"]);
When I use this statement I am getting all the records of dataview..But My requirement is, The value must be from the filtered data..

If the loop is ending, then the condition is met. As others have said, step through the code in the debugger ( F9 sets a breakpoint, F5 debugs ).
 
Share this answer
 
// Some functionality with filtered records(i=1,2,3)


check if in this statement you have incremented the value of i
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900