Datalistitems gets null

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D_W

    #1

    Datalistitems gets null

    I have a small problem here.

    I use a datalist to display products for a webshop. In the datalist
    there is a buy button.
    Clicking on the buy button executes the procedure to add to the cart
    but I can't get the values because the datalists dataitems is all
    null.

    I use this to get the datalistitem

    ImageButton btn = (ImageButton)se nder;
    DataListItem dli = (DataListItem)b tn.NamingContai ner;

    then I try this to get the data
    int productID =
    Convert.ToInt32 (((DataRowView) dli.DataItem).R ow.ItemArray[0].ToString());

    but the item is null.. any ideas?

Working...