locked
ListView Control RRS feed

  • Question

  • User31862606 posted

    Hi All,

          I have list view control which i'm a sqldatasource control ,how can i toggle the visibility of EDIT button for a particular row , based on the value provided by the user in the same row ?

    <asp:ListView ID="lvBankInfo" runat="server" DataKeyNames="BankID" DataSourceID="SqlBankInfo"
    InsertItemPosition="None">
    <ItemTemplate>
    <tr class="gridrow">
    <td>
    <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit" Text="Edit" Visible='<%# togLink() %>'>
    </asp:LinkButton>
    </td>
    <td>
    <asp:Label ID="LblBankName" runat="server" Text='<%# Eval("BankName") %>' />
    </td>
    <td>
    <asp:Label ID="LblRecABANumber" runat="server" Text='<%# Eval("RecABANumber") %>' />
    </td>
    <td>
    <asp:Label ID="LblAccountNumber" runat="server" Text='<%# Eval("AccountNumber") %>' />
    </td>
    <td>
    <asp:Label ID="LblTranCode" runat="server" Text='<%# Eval("TranName") %>' />
    </td>
    <td>
    <asp:Label ID="LblBankStart" runat="server" Text='<%# Eval("BankStart", "{0:d}") %>' />
    </td>
    <td>
    <asp:Label ID="LblBankEnd" runat="server" Text='<%# Eval("BankEnd", "{0:d}") %>' />
    </td>
    <td align="center">
    <asp:CheckBox ID="ckOnHold" runat="server" Checked='<%# Eval("OnHold") %>' />
    </td>
    <td>
    <asp:Label ID="LblInserted" runat="server" Text='<%# Eval("Inserted") %>' />
    </td>
    <td>
    <asp:Label ID="LblUpdated" runat="server" Text='<%# Eval("Updated") %>' />
    </td>
    </tr>
    </ItemTemplate>

    Thursday, January 30, 2014 1:03 PM

All replies

  • User2117486576 posted

    Pass the value you want to evaluate to the togLink() method as a parameter:

    Visible='<%# togLink(Eval("FieldName")) %>'

    Thursday, January 30, 2014 2:02 PM
  • User31862606 posted

    I was doing the same way but it is getting updated for each and every row 

    Thursday, January 30, 2014 2:18 PM
  • User2117486576 posted

    Please post the code for the togLink() method.

    Friday, January 31, 2014 3:23 PM
  • User31862606 posted

    Hi Richard 

    thanks for taking time to answer my doubts.

    Monday, February 3, 2014 5:22 PM
  • User31862606 posted

    Listview

    please find the image listview , on the list view based off the end date i want toggle the create new link button which is not a part of listview

    Monday, February 3, 2014 5:33 PM