Hello Stan,
DataGrid dgTemp = ((DataGrid)send er);
if(dgTemp.EditI temIndex == e.Item.ItemInde x)
{
if(e.Item.ItemT ype.ToString() != "Header" && e.Item.ItemType .ToString() != "Footer")
{
DropDownList ddlTemp = ((DropDownList) e.Item.FindCont rol("myDDL"));
ddlTemp.Items.F indByText("myLo okupValue").Sel ected=true;
}
}
This code could probably be simplified further, but it should be a good starting point.
HTH.
Best regards,
yhhuang
VS.NET, Visual C++
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?
http://www.gotdotnet.com
--------------------
!From: "Stan" <no****@yahoo.c om>
!Subject: How can I access a datagrid control during Edit event?
!Date: Thu, 10 Jul 2003 11:20:22 -0400
!Lines: 25
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
!Message-ID: <#r************ **@TK2MSFTNGP10 .phx.gbl>
!Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
!NNTP-Posting-Host: 12.148.36.131
!Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
!Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1583 35
!X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
!
!This is how I access Pieces field in my editable datargid during Update
!event:
!
!protected void grdMain_OnUpdat e(Object sender, DataGridCommand EventArgs e)
!{
! string Pieces = ((TextBox) e.Item.FindCont rol ("txtPieces")). Text;
! ....
!}
!
!
!I need to highlight this field when user clicks Edit. (This makes easier for
!them to overwrite the content of the field). However, the same code does not
!work during
!Edit event - FindControl returns null. It looks like the the control is not
!available at this time...
!
!
!Is there a way for me to access it AFTER user clicked Edit but BEFORE
!Update?
!
!Thanks,
!
!-Stan
!
!
!