In the OnDataBound event for the grid.
Heres as example.
private void setDataBinding(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType lit = e.Item.ItemType;
if(lit == ListItemType.EditItem)
{
DataRowView drv = (DataRowView) e.Item.DataItem;
DropDownList dll = (DropDownList) e.Item.FindControl("lstLaterability");
etc..
}
}
"K Bryan" <Ke***********@campi.org> wrote in message
news:uH*************@TK2MSFTNGP12.phx.gbl...
Thanks for the reply.
Where would I put this code? What event?
"Andrew de la Harpe" <an*********@hotmail.com> wrote in message
news:u8****************@TK2MSFTNGP12.phx.gbl... You need to find the ddl in the collection of controls.
So you do something like this.
DropDownList ddl = (DropDownList) e.Item.FindControl("lstID");
then select the correct item as required
A
"K Bryan" <Ke***********@campi.org> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl... Hi There,
I have two datagrids on a webform both of which display DropDownLists when edit mode is invoked.
That being said, does anyone have a generic or straightforward way in
C# so that when I go into the edit mode of a row, the dropdownlists display the field values of that row? (They currently jump to the first value in
the dropdownlist)
Any help would be GREATLY appreciated,
_K.