how do i go/setfocus to a datagrid row, based on an outside selection e.g. selected value from dropdownlist

I can retirieve the string value out of the selectedvalue from a dropdownList

using that value -> how do I set focus to the row in a datagrid with the same unique value and update the datagrid??.

private void ddlBook_SelectedIndexChanged(object sender, System.EventArgs e)
{
fails, cant convert string to int ---> dataGrig.SelectedIndex = ddlBook.SelectedValue;
dataGrid.PreRender(); // trying to refresh here to new focused row
}
0
xmlguy
10/21/2003 9:26:39 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

5 Replies
563 Views

Similar Articles

[PageSpeed] 12

Hi,

you need to identify the row in the datagrid that has the value you've selected in the dropdownlist and then set it's selectedItemindex property of the datagrid to that row index.
Hey! It compiles! Ship it!

Cheers,

Venugopal Mallarapu.

Visit : My Blog
0
venumg
10/21/2003 11:02:14 PM
venu, the dropdownlist is outside the datagrid not inside.

so i have
ddlSelectedEventHandler( sender, e)
{
// I was thinking
dataGrid.selectedIndex = ddl.selected.value;
}
0
xmlguy
10/22/2003 6:01:10 AM
venu, the dropdownlist is outside the datagrid not inside.

so i have
to perform a search on the row, how do I access the rows?
0
xmlguy
10/22/2003 6:02:23 AM
xmlguy, I use the following to get the value from a datagrid row and look up a record in the table. Maybe something in the reverse?

Session("EditItem") = e.Item.Cells(0).Text
where e.item.cells(0).text is a value to search on. Hope it helps
0
jebzooey
10/22/2003 6:29:38 PM
jebzooey,

something like that.
after user picked the dll selection, i query that in the dataset used by the datagrid. i now know the row with primary key field.
so i did a datagrid.selectedindex = primary key field // not working though!!!
does the datagrid go on its own index scheme, columns/rows
how do i set the datarow focus
0
xmlguy
10/23/2003 3:41:04 PM
Reply: