OnItemInserting Change values

2 posts, 0 answers
  1. Maurice Thompson
    Maurice Thompson avatar
    4 posts
    Member since:
    Apr 2003

    Posted 13 Mar 2012 Link to this post


    I am converting an existing ListView implementation  bound to an ObjectDataSource into a RadListView.
    I have however reached a problem with the OnItemInserting event where I cannot see where to change the values that are being sent to the ObjectDataSource Insert Method
    For example, in the existing ListView, I can specify:
    protected void lvwTest_ItemInserting(object sender, ListViewInsertEventArgs e)
     e.Values["expert_id"] = 4;


    How can I do this for a RadListView ?

  2. Tsvetina
    Tsvetina avatar
    2102 posts

    Posted 16 Mar 2012 Link to this post

    Hello Maurice,

    As we already discussed the options in this scenario, I will summarize them and close this forum. If you have further concerns, please post in the formal support ticket.

    One option, if InsertParameters are used it to assign them DefaultValue in the ItemCommand event:
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="List"
         TypeName="Test.BL.Course" InsertMethod="CreateCourse">
             <asp:Parameter Name="CourseID" Type="Int64" />
             <asp:Parameter Name="CourseName" Type="String" />
    protected void RadListView1_ItemCommand(object sender, RadListViewCommandEventArgs e)
        if (e.CommandName == RadListView.PerformInsertCommandName)
            ObjectDataSource1.InsertParameters["CourseName"].DefaultValue = "Maths";

    In other, more complex scenarios, it is possible to do the modifications in the insert method of the datasource control.

    Also, we will consider giving control over the insert/edit values in RadListView in future versions of the controls.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top