Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 01, 2009 09:51 AM by NMarcu
Member
7 Points
23 Posts
May 31, 2009 01:11 PM|LINK
Hello,
I have a strange situation:
It's work just fine when I do this:
gridView.dataSource=myAdaptor.getdata(a,b);
gridView.databind();
but when I want to to this:
foreach(string s in listOfStrings)
{
gridView.dataSource=myAdaptor.getdata(s,b);
if(gridView.rows.count!=0)
...do somethnig //never enter in if clauses
}
nothing return.
My need is to see what string from listOfString return some value, and to use it forward, but nothing return 0 counts.
listOfStrings contain sure one value that should return something. I do something wrong here?
Participant
1313 Points
239 Posts
Jun 01, 2009 07:15 AM|LINK
hi..
i think you have to do something like this..
break;
hope this helps..
All-Star
126936 Points
17922 Posts
MVP
Jun 01, 2009 07:28 AM|LINK
Debug your codes, set a break point where you assign the DataSource for your GridView and check whether your Adaptor returns any data.
If it won't go to the line if(gridView.rows.count!=0), then that means there no data returned from your Adaptor query...
Jun 01, 2009 09:51 AM|LINK
I resolve my issue, thank's for help.
NMarcu
Member
7 Points
23 Posts
DataAdaptor don't return values in foreach
May 31, 2009 01:11 PM|LINK
Hello,
I have a strange situation:
It's work just fine when I do this:
gridView.dataSource=myAdaptor.getdata(a,b);
gridView.databind();
but when I want to to this:
foreach(string s in listOfStrings)
{
gridView.dataSource=myAdaptor.getdata(s,b);
gridView.databind();
if(gridView.rows.count!=0)
{
...do somethnig //never enter in if clauses
}
}
nothing return.
My need is to see what string from listOfString return some value, and to use it forward, but nothing return 0 counts.
listOfStrings contain sure one value that should return something. I do something wrong here?
Nicolae Marcu
rushik
Participant
1313 Points
239 Posts
Re: DataAdaptor don't return values in foreach
Jun 01, 2009 07:15 AM|LINK
hi..
i think you have to do something like this..
foreach(string s in listOfStrings)
{
gridView.dataSource=myAdaptor.getdata(s,b);
gridView.databind();
if(gridView.rows.count!=0)
{
...do somethnig //never enter in if clauses
}
break;
}
hope this helps..
---------
Rushik
vinz
All-Star
126936 Points
17922 Posts
MVP
Re: DataAdaptor don't return values in foreach
Jun 01, 2009 07:28 AM|LINK
Debug your codes, set a break point where you assign the DataSource for your GridView and check whether your Adaptor returns any data.
If it won't go to the line if(gridView.rows.count!=0), then that means there no data returned from your Adaptor query...
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
NMarcu
Member
7 Points
23 Posts
Re: DataAdaptor don't return values in foreach
Jun 01, 2009 09:51 AM|LINK
I resolve my issue, thank's for help.
Nicolae Marcu