We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,134 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

ListView

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
1 Week
Discussion Span
2 Months Ago
Last Updated
11
Views
nazmule27
Newbie Poster
4 posts since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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.

LastMitch
Industrious Poster
4,165 posts since Mar 2012
Reputation Points: 132
Solved Threads: 335
Skill Endorsements: 45

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0539 seconds using 2.66MB