我对gridview有一个问题............ [英] I have a problem regarding gridview............

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

问题描述

当我点击网格视图的按钮时,该行将被隐藏........它永远不会再显示在gridview中.....

aspx



When i click on the button of grid view then that row will be hide........it never show again in gridview.....
aspx

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
           CellPadding="3" ForeColor="#333333" GridLines="None" 
     CellSpacing="4" Width="92%"  Visible="False" BorderColor="#DEBA84" 
           BackColor="#DEBA84" BorderStyle="None" BorderWidth="1px" AllowPaging="True" 
           onpageindexchanging="GridView1_PageIndexChanging" DataKeyNames="P_id" 
           onrowdatabound="GridView1_RowDataBound" 
        >
     <columns>
        <asp:BoundField HeaderText="Username" DataField="Uname" />
        <asp:BoundField HeaderText="Product name" DataField="Product_name" />
        <asp:BoundField HeaderText="Product Quantity" DataField="Product_quan"  />
        <asp:BoundField HeaderText="Delivery Date (MM/DD/YYYY)" DataField="Delivery_date" />
        <asp:BoundField HeaderText="Extend Date (MM/DD/YYYY)" DataField="Extend_date" />
        <asp:BoundField HeaderText="Product Information" DataField="check_bit"  />
        <asp:TemplateField>
        <itemtemplate>
        <asp:LinkButton ID="click" runat="server" Text="Dispatch">
        </itemtemplate>
         <asp:TemplateField>
        <itemtemplate>
          <asp:LinkButton ID="lnkbtn" runat="server" Text="InvDisp" ForeColor="Blue">
        </itemtemplate>
    </columns>
        <footerstyle backcolor="#990000" font-bold="True" forecolor="White" />
        <pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="White" BorderColor="#738A9C"  />
        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" Height="30%" />
        <alternatingrowstyle backcolor="White" />



.cs




.cs

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRowView row = (DataRowView)e.Row.DataItem;
                string eid = ((LinkButton)e.Row.FindControl("click")).Text;
            
                string lnkbtn = ((LinkButton)e.Row.FindControl("lnkbtn")).Text;
                string param = "challan_report.aspx?P_id=" + row["P_id"] + "&Uname=" + row["Uname"];
                ((LinkButton)e.Row.FindControl("click")).Attributes.Add("OnClick", "window.open('" + param + "','PopupWindow','toolbar=no, location=no, directories=no,titlebar=no, status=no, menubar=no,resizable=NO,scrollbars=NO,copyhistory=no,width=600,height=600,top=20,left=20')");
                string caram = "Invoice.aspx?P_id=" + row["P_id"] + "&Uname=" + row["Uname"];
                ((LinkButton)e.Row.FindControl("lnkbtn")).Attributes.Add("OnClick", "window.open('" + caram + "','PopupWindow','toolbar=no, location=no, directories=no,titlebar=no, status=no, menubar=no,resizable=NO,scrollbars=NO,copyhistory=no,width=600,height=600,top=20,left=20')");
                
            }


        }

推荐答案

这个问题没有感。发布一些代码,以便我们知道你的意思。您可以使用javascript隐藏UI中的行,但删除行的最佳方法是从数据源中删除它们。
This question makes no sense. Post some code so we know what you mean. you can hide rows in the UI with javascript, but the best way to remove rows, is to remove them from the data source.


在数据库表中添加另一列作为位类型网格视图绑定。

并在按钮点击事件上更新该列的值。

将gridview绑定为
Add another column as bit type in database table by which your grid view bind.
and update value of that column on button click event.
bind gridview as
select *from table1 where status=false.




$ b更新record.as后$ $绑定gridview.as





bind gridview after updateing record.as

gridview1.DataBind();


这篇关于我对gridview有一个问题............的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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