1

sorry in advance I have searched the whole site but I can not find an answer to this question

I plan to use the listview with checkboxes in every item and one delete button so that I can do a removal to multiple row at once, is there any way that I can start this work?

this is my current code

<asp:ListView ID="ListInbox" runat="server" DataKeyNames="MessageID" 
    DataSourceID="LinqDataSourceInbox" >
    <EmptyDataTemplate>
    There is no message
    </EmptyDataTemplate>

    <ItemTemplate>
    <table runat="server">
    <tr runat="server">
    <td runat="server">
    <asp:CheckBox ID="CheckBoxSelect" runat="server" />
    </td>
    <td runat="server">
    <asp:Panel ID="PanelMsg" runat="server" Width="400px">
        <a href='UserProfile.aspx?UserName=<%# Eval("FromUserName") %>'><img src="ProfilePic/<%#Eval("User.ProfilePic") %>" alt='' width="25"  /></a>
        <a href='UserProfile.aspx?UserName=<%# Eval("FromUserName") %>'><%# Eval("FromUserName") %></a>
        write you message: 
        <a href='ViewMessages.aspx?MsgID=<%# Eval("MessageID") %>'><%# Eval("Subject") %></a>
        <%# Eval("MessageTime") %>
    </asp:Panel>
    </td>
    </tr>
    </table>
    <hr style="text-align:left; width:400px;" />
    </ItemTemplate>

    <LayoutTemplate>
    <div style="min-height:450px;">
    <div runat="server" id="itemPlaceholder">
    </div>
    </div>
    </LayoutTemplate>
</asp:ListView>

The questions are

  1. Where the CheckBox put? Selected/Item template?
  2. Where the Delete Button put? Inside/Outside ListView?

Thx in advance..

2

1 Answer 1

1

We do smth similar with a GridView backed with a DataTable, I suppose I can give you a general idea and you can do smth similar.

  1. Create a flag column/ field. e.g: User.SetToDelete
  2. onCheckChanged set this flag to true.
  3. Upon Click of the delete button, iterate the rows and look for items set to be deleted.

As for the suggestion for a simple GUI:

Grid with multiple delete

Hope it helps.

Sign up to request clarification or add additional context in comments.

1 Comment

I should probably start switch to gridview .. thank you very much Mr. Zortkun

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.