Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control Refresh() Method
Message
From
08/07/2004 10:47:20
 
 
To
08/07/2004 02:12:01
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00921607
Message ID:
00921998
Views:
19
Steve,

Looks like you found the solution (after I went to bed last night I thought that I should have mentioned rolling your own by iterating through the rows, so yeah, it's a good way to do it). And you've gotten good feedback from Kevin and Danny. Looks like my job is done. <g>

~~Bonnie

>>The "correct" way to move to the right row would be to mess with the BindingContext[].Position, but I don't know if there's a built-in way to get there when using the .Find() or not.
>
>Okay, here's a generalized solution that I'm going to go with, until I figure out otherwise. Haven't tested it for non-string key values yet, but it should work out.
>
>I really appreciate your help...it means a lot on my C# crash course. :)
>
>
>private bool MoveBindingPosition(DataTable oTable,
>                                     string fieldName, object lookupValue)
>{
>
>   bool Found = false;
>   int i = 0;
>
>   foreach (DataRow oRow in oTable.Rows)
>   {
>      if (oRow[fieldName].ToString() == lookupValue.ToString())
>      {
>         Found = true;
>         this.BindingContext[oTable].Position = i;
>         break;
>      }
>      i++;
>   }
>		
>   return Found;
>
>}
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform