تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مشكلة عند حذف سجل من grid view
#1
عندي مشكلة لما بحذف سجل من grid view باستخدام RowDeleting

الخطأ هو ؟:-
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

الكود:

كود :
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string delete = GridView1.DataKeys[e.RowIndex].Values["aid"].ToString();SqlCommand  com = new SqlCommand( "delete from advert where aid=@aid",cn);

            com.Parameters.AddWithValue("@aid", delete);
            cn.Open();
            com.ExecuteNonQuery();
            cn.Close();

ارجو المساعدة ^_^
الرد }}}
تم الشكر بواسطة:
#2
حلت المشكلة خلاص ................. ^_^
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم