将新的空行添加到gridview控件 [英] Add New Empty row to gridview control

查看:94
本文介绍了将新的空行添加到gridview控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



请有人告诉我如何在gridview顶部添加一个新的空行,并且它应该是可编辑的,并且还可以在gridview顶部添加数据。 />


谢谢和问候,

amol

Hi,
please some one tell me how to add a new empty row at the top of the gridview and also it should be editable and also add the data at the top of gridview.

Thanks and regards,
amol

推荐答案

看看这篇文章:

可编辑的嵌套DataGrid [ ^ ]



Have a look at this article:
Editable Nested DataGrid[^]

AmolNagrkar写道:
AmolNagrkar wrote:

在gridview顶部添加数据

add the data at the top of gridview



根据您在代码库中的选择进行调整上面。


Adjust this according to your choice in the codebase above.


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //This is a Test Condition
        if (e.Row.RowIndex % 2==0)
        {
            GridViewRow g = new GridViewRow(-1,-1, DataControlRowType.DataRow, DataControlRowState.Normal);
            for (int i = 0; i < e.Row.Cells.Count; i++)
            {
                //creating table Cells
                TableCell tCell = new TableCell();
                tCell.Text = "&nbsp;";
                //Add Cells
                g.Cells.Add(tCell);
                //Set Color for Empty Cell
                g.BackColor = System.Drawing.Color.Red;
            }
            Table tbl = e.Row.Parent as Table;
            //add rows
            tbl.Rows.Add(g);
        }
    }






今天很好,



这个上面的灵魂对我来说很好,但是在下面的实际行的girdview中添加了custom。

我需要你的帮助它让客户排在网格的顶部。

预先感谢



谢谢,

Muni
Hi,

Good Today,

This above soultion is working fine for me, but custome is get added in the girdview on the below th actual row.
I need your help on it to make custome row on the top of the grid.
Thanks in Advance

Thanks,
Muni


这篇关于将新的空行添加到gridview控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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