0

I have a problem in listview to select a specific row. I want to select a row in click event please help.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ListView Showing</title>

    <link href="CSS/yui/tblstyle.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
    <script src="js/jquery.tablesorter-2.0.3.js" type="text/javascript"></script>
    <script src="js/jquery.tablesorter.filer.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#yui").tablesorter({ debug: false, sortList: [[0, 0]], widgets: ['zebra'] })
                .tablesorterFilter({ filterContainer: $("#filterBox"),
                    filterClearContainer: $("#filterClear"),
                    filterColumns: [0, 1, 2, 3, 4, 5, 6],
                    filterCaseSensitive: false
                });
        });         
    </script>
</head>
<body>
    <form id="form1" runat="server">        
        <asp:ObjectDataSource ID="odsCustomers" runat="server" SelectMethod="Select" TypeName="CustomersDataObject" />
        <asp:ListView ID="ListView1" runat="server" class="LVheiht">
        <LayoutTemplate>
            <table id="yui" class="yui">
                <thead>
                    <tr>
                        <td class="tableHeader">
                            Accounts
                        </td>
                        <td colspan="6" class="filter">
                            Search: <input name="filter" id="filterBox" value="" maxlength="30" size="30" type="text">
                            <img class="crosImg" id="filterClear" src="images/cross.png" title="Click to clear filter." alt="" />
                        </td>
                    </tr>
                    <tr>
                        <th width="50">
                            <a href="#">BRCode</a>
                        </th>
                        <th width="50">
                            <a href="#">ACLevel1</a>
                        </th>     
                        <th width="50">
                            <a href="#">ACLevel2</a>
                        </th>
                        <th width="50">
                            <a href="#">ACLeve3</a>
                        </th>
                        <th width="50">
                            <a href="#">ACLeve4</a>
                        </th> 
                        <th width="250">
                            <a href="#">ACName</a>
                        </th>                     
                    </tr>
                </thead>
                <tbody>
                    <tr id="itemPlaceholder" runat="server" />
                </tbody>                                               
            </table>
        </LayoutTemplate>
        <ItemTemplate>
            <tr>
                <td><%# Eval("BRCode")%></td>
                <td><%# Eval("ACLevel1")%></td>
                <td><%# Eval("ACLevel2")%></td>
                <td><%# Eval("ACLevel3")%></td>
                <td><%# Eval("ACLevel4")%></td>
                <td><%# Eval("ACName")%></td>
            </tr>
        </ItemTemplate>
        </asp:ListView>        
    </form>     
</body>
</html>
2
Contributors
1
Reply
11
Views
3 Years
Discussion Span
Last Post by LastMitch
0

I have a problem in listview to select a specific row. I want to select a row in click event please help.

I'm not sure why you include javascript?

I don't see any property in your code to select the listview?

Why not include property? If you didn't create one then try this:

Read this ( which will include how to select the row from the listview ):

http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.fullrowselect.aspx

and this:

http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.selecteditems.aspx

Both links explain how to used it and also it provide an example which you are used it for your own code.

Edited by LastMitch: grammer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.