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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting a row from a datalist

Status
Not open for further replies.

WorkerBeeJ

Programmer
Aug 6, 2002
34
US
I'm trying to figure out how to find the appropriate row in my dataset without having to do a select that will return one row and then selecting that one row. In vb.net, I'd use the FindByMenuItemID method, but that doesn't seem to be working in c#. Anyone know what I'm doing wrong? Here's the code:

...

private void m_dlMenuItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
switch (e.CommandName)
{
case ("deleteMenuItem"):
// handles the user selecting delete
// and ok'ing the confirm dialog
DataList dl = (DataList)source;
int iItemID = (int)((DataList)source).DataKeys[e.Item.ItemIndex];
DataRow[] oDataRow;
MenuItemDataset.MenuItemRow oItemRow;
oDataRow = m_dsMenuItem.MenuItem.Select("MenuItemID = " + iItemID);
oItemRow = (MenuItemDataset.MenuItemRow)oDataRow[0];

...


Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top