从ListView asp.net获取单元格值

时间:2014-12-23 09:21:30

标签: asp.net listview

我有列表视图控件,其中我显示一些乘客详细信息,如名字姓氏等每行代表一个乘客记录现在我使用两个按钮来制作故障单和每个按钮上的URLCode点击我想获取乘客URL代码或发行票证的PNR代码。我的问题是我无法获得按钮点击事件的值你能建议我一些方法来获取代码背后的数据。你可以找到我的代码。

 <asp:ListView ID="showReservationDetails" runat="server" EnableViewState="False"
                OnPagePropertiesChanging="showReservationDetails_OnPagePropertiesChanging">
                <ItemTemplate>
                    <tr>
                        <td><%# Eval("ReservationCode")%></td>
                        <td><%# Eval("URLCode")%></td>
                        <td><%# Eval("ProviderCode")%></td>
                        <td><%# Eval("Status")%></td>
                        <td><%# Eval("Origin")%></td>
                        <td><%# Eval("Destination")%></td>
                        <td><%# Eval("TotalPrice")%></td>
                        <td><%# Eval("BasePrice")%></td>
                        <td><%# Eval("FirstName")%></td>
                        <td><%# Eval("LastName")%></td>
                        <td><%# Eval("ContactNumber")%></td>
                        <%--<td><asp:Button runat="server" Text="IssueTicket" ID="btnTicketRequest" CssClass="btn btn-primary btn-xs"  /> </td>
                        <td><asp:Button runat="server" Text="GetURICode" ID="btnURLRequest" CssClass="btn btn-primary btn-xs" /> </td>
                        --%>
                        <td>
                            <button id="btnTicketRequest" class="btn btn-primary btn-xs" runat="server" OnServerClick="btnTicketRequest_OnServerClick"
                                name="<%# Eval("ReservationCode")%>"></button>
                            <button id="btnUrlRequest" class="btn btn-primary btn-xs" runat="server" OnServerClick="btnUrlRequest_OnServerClick" 
                                name="<%# Eval("URLCode")%>"
                                mytag="something"></button>

                        </td>


                    </tr>
                </ItemTemplate>
                <LayoutTemplate>
                    <div class="table-responsive">
                        <table id="tbl1" runat="server" class="table table-striped table-condensed small">
                            <tr id="tr1" runat="server" class="success">
                                <th id="td1" runat="server">ReservationCode</th>
                                <th id="td2" runat="server">URLCode</th>
                                <th id="td3" runat="server">ProviderCode</th>
                                <th id="td4" runat="server">Status</th>
                                <th id="td5" runat="server">Origin</th>
                                <th id="td6" runat="server">Destination</th>
                                <th id="td7" runat="server">TotalPrice</th>
                                <th id="td8" runat="server">BasePrice</th>
                                <th id="td9" runat="server">FirstName</th>
                                <th id="td10" runat="server">LastName</th>
                                <th id="td12" runat="server">ContactNumber</th>
                                <th id="Th1" runat="server">GetTicket</th>
                                <th id="Th2" runat="server">URICode</th>

                            </tr>
                            <tr id="ItemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </div>
                </LayoutTemplate>

                <EmptyDataTemplate>  
            <table class="table">  
                <tr>  
                    <th class="danger text-center">  
                        No record found against provided data.  
                    </th>                      
                </tr>  
            </table>  
        </EmptyDataTemplate>  
            </asp:ListView>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-lg-4">
            <asp:DataPager ID="dataPager" runat="server" PagedControlID="showReservationDetails" PageSize="10">
                <Fields>
                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowPreviousPageButton="True"
                        ShowNextPageButton="False" ButtonCssClass="btn btn-primary btn-xs" />
                    <asp:NumericPagerField ButtonType="Link" />
                    <asp:NextPreviousPagerField ButtonType="Button" ButtonCssClass="btn btn-primary btn-xs"
                        ShowNextPageButton="True" ShowLastPageButton="True" ShowPreviousPageButton="False" />
                </Fields>
            </asp:DataPager>
        </div>
    </div>

0 个答案:

没有答案