thanks that worked!. Just had an additional question, I need the grid to
have 2 dropldown boxes but want the other fields to be two empty text box
columns for data entry, and a checkbox column for bool entry as well as a
final row count column,(just displays the row count). I had to bind the grid
to results of a dataset just to get the grid to show up so it currently has
extra undesired data from this dataset. Should I just create an empty
dataset and bind it to so a single row with two dropdowns and the other
fields discribed above show up?
Also I noticed there is no way to add a new row within the control, so
guessing this might have to be done outside the control.
Paul G
Software engineer.
"Lee Thorpe" wrote:
Paul
You need to use FindControl within your RowDataBound event-handler, i.e.
protected void gridview_RowDataBound(object sender, DataGridItemEventArgs e)
{
DropDownList ddl = e.Row.Cells[columnIndex].FindControl("ddl") as
DropDownList;
if(ddl != null)
{
// Databind, or populate ListItems in a loop.
}
}
"Paul" <Pa**@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.com...
Hi I have a generic list of data
list <typelistcategory;
listcategory = new list <type>;
I also have a dropdown box that I have put into a template column of a
gridview.
I was able to populate the dropdown box ok when it was outside of the
gridview
for (int i = 0; i <= listcategory.Count - 1; i++)
{
ddl.Items.Add(listcategory[i].Description);
}
Now that the control is in the gridview, ddl is not recognized.
I tried the following event but it does not seem to be reaching it.
protected void gridview_RowDataBound(object sender, DataGridItemEventArgs
e)
{
;
}
I also tried the template edit from the gridview properties but could not
see how to bind the dropdown box to the items listcategory[i].Description.
Thanks.
--
Paul G
Software engineer.