Insert, Update, Delete RadListView From Code behind

2 posts, 0 answers
  1. Rasha
    Rasha avatar
    4 posts
    Member since:
    Apr 2013

    Posted 09 May 2013 Link to this post

    Hi to all,
    Sorry to bother you with what might seem beginners question, I tried  to use ListView1_ItemCommand to as shown in my code below, but nothing happened the insert command is not firing should I use OnCommandInserting, if there is a form or example on how this could be done I would deeply appreciated.
    if (e.CommandName == RadListView.PerformInsertCommandName)
        SqlCommand cmd = new SqlCommand();
            SqlConnection con = DataAccess.Connection.GetDBConnection();
            if (con.State == ConnectionState.Closed)
            cmd.CommandText = "INSERT INTO [Package] VALUES (@PackageName, @PackageDesc, @PricePerMonth, @discountPercent, @NumOfImg, @NumOfGIF, @NumOfFlash, @isHomePageIncluded)";
            cmd.Parameters.Add("@PackageName", SqlDbType.VarChar);
            cmd.Parameters.Add("@PackageDesc", SqlDbType.VarChar);
            cmd.Parameters.Add("@PricePerMonth", SqlDbType.Money);
            cmd.Parameters.Add("@discountPercent", SqlDbType.Float);
            cmd.Parameters.Add("@NumOfImg", SqlDbType.Int);
            cmd.Parameters.Add("@NumOfGIF", SqlDbType.Int);
            cmd.Parameters.Add("@NumOfFlash", SqlDbType.Int);
            cmd.Parameters.Add("@isHomePageIncluded", SqlDbType.Bit);
            cmd.Connection = con;
            int result = cmd.ExecuteNonQuery();
        catch (Exception exp)
            Response.Write(exp +"in Command: " + cmd.ToString());

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 May 2013 Link to this post

    Hi Rasha,

    Please have a look into this demo which demonstrates Manual Datasource operations such as insert, delete, update with the RadListView Control.

  3. DevCraft R3 2016 release webinar banner
Back to Top