GridView动态绑定字段做参数,动态调用JS传参-JS

<div style="margin-top: 13px;">
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="_id" Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None">
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                    <asp:BoundField DataField="_id" HeaderText="id">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="景点标题">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("_title") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("_title") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:ImageField DataImageUrlField="imgURL" HeaderText="景点图片">
                        <ItemStyle HorizontalAlign="Center" Width="100" Height="100" />
                    </asp:ImageField>
                    <asp:TemplateField HeaderText="生成二维码">
                        <ItemTemplate>
                            <input type="button" value="生成二维码" onclick="<%# "utf16to8('"+Eval("_id")+"')" %>" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <%--<asp:BoundField DataField="_author" HeaderText="作者">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>--%>
                    <asp:BoundField DataField="astopname" HeaderText="是否置顶">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="_click" HeaderText="点击数">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="_posttime" HeaderText="景点发布时间">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="typeName" HeaderText="所属景区">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <%--<asp:BoundField DataField="_ispic" HeaderText="内容类型">
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>--%>
                    <asp:TemplateField HeaderText="添加" ShowHeader="False">
                        <ItemTemplate>
                            <a href='sceneryListadd.aspx?uid=<%#Eval("_id")%>'>添加</a>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="更新" ShowHeader="False">
                        <ItemTemplate>
                            <a href='sceneryListupdate.aspx?uid=<%#Eval("_id")%>'>编辑</a>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="选择框">
                        <EditItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
            <div style="text-align: center;">
                <asp:Button ID="Button1" runat="server" Text="全选" OnClick="Button1_Click" />
                <asp:Button ID="Button2" runat="server" Text="反选" OnClick="Button2_Click" />
                <asp:Button ID="Button3" runat="server" Text="删除" OnClientClick="return confirm('你确定要删除这些记录?')" OnClick="Button3_Click" />
            </div>
        </div>
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页"
            HorizontalAlign="Center" LastPageText="尾页" NextPageText="下一页"
            PrevPageText="上一页" OnPageChanging="AspNetPager1_PageChanging1">
        </webdiyer:AspNetPager>

 

posted @ 2019-11-29 09:33  离。  阅读(35)  评论(0编辑  收藏