如何在网格视图中显示按钮 [英] how to display a button inside grid view

查看:69
本文介绍了如何在网格视图中显示按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

感谢您的回复。



我们正在使用Gridview,因为我有一个按钮和一个文本当我们点击按钮时,文本必须是可见的,如何使用javascript或jquery来执行它。









谢谢&问候

Lakshman

解决方案

您可以按以下方式添加按钮和文本框,以便在单击按钮文本框时显示:

 <   asp:content     id   =  BodyContent    contentplaceholderid   =  MainContent    runat   =  server    xmlns:asp   = #unknown >  

< div class = jumbotron >

< asp:gridview < span class =code-attribute> autogeneratecolumns = false id = gdv1 runat = 服务器 >
< c olumns >
< asp:boundfield datafield = ID / >
< asp:boundfield datafield = FirstName / >
< asp:boundfield 数据字段 = LastName / >
< asp:templatefield >
< ; itemtemplate >
< 输入 type = text id = <% #Eval( ID%> 隐藏 = hidden < span class =code-attribute> / >
< / itemtemplate >
< / asp:templatefield >
< asp:templatefield >
< itemtemplate >
< 输入 类型 = 按钮 value = show onclick = 显示(此) / >
< / itemtemplate >
< / asp:templatefield >
< / columns >

< / asp:gridview >



< / div >



< script type = text / javascript >
function 显示(e){


row =


(e).parent().siblings( < span class =code-string>)。find(' input') ;

Hi
Thank you for Reply.

We are using Gridview in that i have one button and one text box when ever we click button that text must be visible how to do it using javascript or jquery.




Thanks & Regards
Lakshman

解决方案

You can add button and textbox in the following manner so that when click on button textbox will be shown:

<asp:content id="BodyContent" contentplaceholderid="MainContent" runat="server" xmlns:asp="#unknown">

    <div class="jumbotron">

                <asp:gridview autogeneratecolumns="false" id="gdv1" runat="server">
            <columns>
                <asp:boundfield datafield="ID" />
                <asp:boundfield datafield="FirstName" />
                <asp:boundfield datafield="LastName" />
                <asp:templatefield>
                    <itemtemplate>
                        <input type="text" id="<%#Eval("ID") %>" hidden="hidden" />
                    </itemtemplate>
                </asp:templatefield>
                <asp:templatefield>
                  <itemtemplate>
                      <input type="button"  value="show" onclick="Show(this)"  />
                  </itemtemplate>
                </asp:templatefield>
            </columns>

        </asp:gridview>

            
        
    </div>

  
 
<script type="text/javascript">
    function Show(e) {


row =


(e).parent().siblings("").find('input');


这篇关于如何在网格视图中显示按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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