Set ListView in EditMode via a control outisde the Listview

3 posts, 0 answers
  1. Tim
    Tim avatar
    7 posts
    Member since:
    Aug 2012

    Posted 13 Nov 2013 Link to this post

    Good day, I'm merely trying to set the ListView in EditMode via the use of a radButton_click but nothing I've tried so far has worked.

    <
    telerik:RadListView ID="CommitmentsListView" runat="server" DataKeyNames="AgreementID" ItemPlaceholderID="CommitmentsContainer"
                                                                                    EnableViewState="true" InsertItemPosition="FirstItem" >
        <LayoutTemplate>
            <div style="min-height: 100px">
                <asp:PlaceHolder runat="server" ID="CommitmentsContainer" />
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <div style="text-align:right;padding-right:2px;">
                <asp:Label ID="lblCommitmentNumber" runat="server" Text="Commitment Number:" Font-Bold="true" Style="margin-top:5px;font-size:0.75em;"></asp:Label>
                <br />
                <asp:Label ID="lblPurchaseOrder" runat="server" Text="Purchase Order:" Font-Bold="true" Style="margin-top:5px;font-size:0.75em;"></asp:Label>
            </div>
        </ItemTemplate>
        <EditItemTemplate>
            <div style="text-align:right;padding-right:2px;">
                <asp:Label ID="lblCommitmentNumber" runat="server" Text="Commitment Number:" Font-Bold="true" Style="margin-top:5px;font-size:0.75em;"></asp:Label>
                <br />
                        <telerik:RadComboBox ID="PurchaseOrder" runat="server" HighlightTemplatedItems="true" Style="font-weight:Bold;" 
                                        DataTextField="PurchaseOrder" DataValueField="PurchaseOrder"  Width="80px" AutoPostBack="true" >
                        </telerik:RadComboBox>                   
            </div>
     
        </EditItemTemplate>
     </telerik:RadListView>
     
    <telerik:RadButton ID="EditButton" runat="server" Text='Edit' CommandName="Edit" CausesValidation="false">
        <Icon PrimaryIconCssClass="rbEdit" PrimaryIconLeft="4" PrimaryIconTop="4"></Icon>
    </telerik:RadButton>
    Private Sub CommitmentsListView_NeedDataSource(sender As Object, e As RadListViewNeedDataSourceEventArgs) Handles CommitmentsListView.NeedDataSource
     
        Dim myList As New List(Of BudgetCommitment)
        myList.Add(New BudgetCommitment("001AR1101-E", 2015))
     
        CommitmentsListView.DataSource = myList.ToList
     
    End Sub
     
    Private Sub EditButton_Click(sender As Object, e As EventArgs) Handles EditButton.Click
     
    End Sub
  2. Tim
    Tim avatar
    7 posts
    Member since:
    Aug 2012

    Posted 13 Nov 2013 Link to this post

    After all this testing, two minutes after I posted, I got the below to work.

    Private Sub EditButton_Click(sender As Object, e As EventArgs) Handles EditButton.Click
        CommitmentsListView.IsItemInserted = False
        For i = 0 To CommitmentsListView.PageSize - 1
            CommitmentsListView.EditIndexes.Add(i)
        Next
        CommitmentsListView.Rebind()
    End Sub



  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eyup
    Admin
    Eyup avatar
    3009 posts

    Posted 18 Nov 2013 Link to this post

    Hi Tim,

    I am glad you have managed to find a solution yourself.
    You can also try:
    RadListView1.EditIndexes.AddRange(Enumerable.Range(0, RadListView1.Items.Count));

    Please let us know if new questions arise.

    Regards,
    Eyup
    Telerik
    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 the blog feed now.
Back to Top