如何使用ListView值 [英] how to use listview values

查看:62
本文介绍了如何使用ListView值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:ListView ID="ListView1" runat="server" DataKeyNames="Service_ID"

            DataSourceID="SqlDataSource3" InsertItemPosition="FirstItem"

            ItemPlaceholderID="Placeholder1" Visible="False">
            <LayoutTemplate>
                <table ID="table1" runat="server" border="1" width=100%>
                    <tr>
                        <th class="subheader" colspan="3">
                            Services</th>
                        <th>
                            <asp:LinkButton ID="lnkService" runat="server"></asp:LinkButton>
                        </th>
                    </tr>
                    <tr ID="Placeholder1" runat="server">
                    </tr>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("Service_Name")%>
                    </td>
                    <td>
                        <asp:CheckBox ID="chkService" runat="server" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtServices" runat="server"></asp:TextBox>
                    </td>
                </tr>
            </ItemTemplate>
            <InsertItemTemplate>
                <asp:LinkButton ID="Link1" runat="server" Text="Edit"></asp:LinkButton>
            </InsertItemTemplate>
        </asp:ListView>


<asp:DataPager runat="server" ID="DataPager1"  PagedControlID="ListView1"

                Visible="False">
            <Fields>
                <asp:NumericPagerField />
            </Fields>
        </asp:DataPager>


<asp:DropDownList ID="ddlServer" runat="server" CssClass="dropdownlistLarge" Font-Size="10"

            AutoPostBack="true" OnSelectedIndexChanged="ddlServer_SelectedIndexChanged" DataTextField="Server_Name"

             DataValueField="Server_ID" DataSourceID="SqlDataSource1">
                      </asp:DropDownList>




如何访问下拉选择中的listview项,其中我可以在其中将值插入到listview的复选框和文本框中,并将其绑定到gridview的特定列上.




how to access listview items on dropdown selection where in i can insert values into checkbox and textbox in listview and the same to be bind to a particular column of a gridview

推荐答案

您需要的只是ListView的.FindControl属性.

看看这个:
http://stackoverflow.com/questions/1001548/c-sharp-how-to-access-a-dropdownbox-in-a列表视图 [
All you need is .FindControl property of your ListView.

Have a look at this :
http://stackoverflow.com/questions/1001548/c-sharp-how-to-access-a-dropdownbox-in-a-listview[^]


这篇关于如何使用ListView值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆