Skip to content
Loading
Problem in Null object
  • Aktham Mahmoud
    Jignesh Kumar
    HI
    Actually you soulutions in first line 
    1. int id = (int)gvbremployee.DataKeys[e.RowIndex].Value;
    make delete event work(catch row index correctly)
    but I faced a two problems:
    first: a message error
    Specified cast is not valid.
    I searched in web about that error, a result is:
    there is problem in row index type (int) someone said change to UIint32, I change it but a meassage error still as it when I delete row in gridvie.
    a second problen my stored procedure not working corectly is just execute one command line from backge of command. am working on this mistakes.
  • Jignesh Kumar
    Hi,
     
    You are trying to find datakey values from row.RowIndex. You should find like below e.RowIndex(Here e is event trgger from which row,
    1. int id = (int)gvbremployee.DataKeys[e.RowIndex].Value;  
     or
    1. string idvalue = gvbremployee.DataKeys[e.RowIndex].Values["UserId"].ToString();  
     
  • Salman Beg
    See this link, https://www.webcodeexpert.com/2013/03/how-to-read-datakeynames-on-gridviews.html?m=1 https://www.c-sharpcorner.com/forums/datakeynames-value-at-gridview-rowdeleting-event