Re: Null reference in Item
- From: "Sam" <askhuy@xxxxxxxxx>
- Date: Tue, 11 Jul 2006 22:35:00 -0400
Avnrao,
Other thing I notice that the data seems to bind to the dropdownlist when I
click on the edit link of the datagrid row. Do you have any idea what might
cause it?
Sam
"avnrao" <avnrao@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3CE16162-CC51-49B9-A531-5EF8914C4D6E@xxxxxxxxxxxxxxxx
I think you need to use this check
if ( e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem )
{
//bind data
}
Note : code is in C#.
"Sam" wrote:
Hi All,
I'm having troubles with populating data to the dropdownlist in a
datagrid
and I just don't know what causes it. I have been struggling for 2 days
now
Would some one give me a hand?
Here is what I have in the ItemDataBound
Dim ddlProduct As DropDownList =
CType(e.Item.Cells(1).FindControl("ddlFinalOffer"),
System.Web.UI.WebControls.DropDownList)
Dim ds1 As DataSet
ds1 = CreateDataSet()
ddlProduct .DataTextField = "ProductDesc"
ddlProduct.DataValueField = "ProductID"
ddlProduct .DataSource = ds1.Tables(0)
ddlProduct.DataBind()
some how I keep having null reference error and when I debug it, the
ddlProduct variable shows "nothing" when I hover my mouse on this
variable.
It breaks when I tried to assign datafield to it. The code above shows
ok
if I put in the "edit" event handler of the datagrid but the data does
not
get populated in the dropdownlist.
Regards,
Sam
.
- References:
- Null reference in Item
- From: Sam
- Null reference in Item
- Prev by Date: Re: The underlying connection was closed: Could not establish secure channel for SSL/TLS.
- Next by Date: Re: Browser Caching Problem
- Previous by thread: Re: Null reference in Item
- Next by thread: Window.Open / Window.Close question
- Index(es):
Relevant Pages
|