DropDownList in DataGrid EditMode

I

Islam Elkhayat

In my webproject i have a datagrid.. i added a DropDownList in the edit mde
and in the Datagrrd1_ItemDataBound i bind data from dataview using:

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
DropDownList list = (DropDownList)Datagrid1.FindControl("myddl");
list.DataSource = dv;
list.DataTextFeild= "Name";
list.DataValueFeild = "ID";
list.DataBind();

but i got and "object refrence not set to an instance of an object"
Exception..
it seem it's try to bind data b4 creating the DropDownlist itself!!

i add another Dropdownlist outside the grid which use the same Datasource
and it's wrk perfectly.
 
S

svoeller102

is this a web user control you're developing? i vaguely recall a call
that I've had to make in the past, under similar circumstances, to
assert that the control has been created. sorry I can't remember off
hand
 
I

Islam Elkhayat

sure i did add a dropdownlist control to a Template column in the edit item
template..
is there a way to fix the error?
thanx
 
G

Guest

are you sure you have the ONITEMDATABOUND="Datagrrd1_ItemDataBound" set in
the html? your code is all fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top