在可编辑Gridview的页脚处添加行 [英] Add row at the footer of Editable Gridview

查看:84
本文介绍了在可编辑Gridview的页脚处添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在Gridview的页脚处添加了新行,但没有在文本框中获取值.
我也使Gridview直接可编辑.

当我制作一个简单的应用程序而不使Gridview可编辑时,添加行的代码可以正常工作,但是如果我将可编辑的Gridview与添加行一起使用,它将无法获取值.
请帮助以下是我的代码:

Hi,
I am adding a new row at the footer of the Gridview but i am not getting values in the textboxes.
Also i have made the Gridview directly editable.

When i make a simple application without making Gridview editable the code to add row works fine but if I use add row with editable Gridview it does not get values.
Please help following is my code:

protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
{              
        if (e.CommandName == "Submit")
        {
            string prodid = ((TextBox)ddgrnstatus.FooterRow.FindControl("ProdId")).Text;
            string Dis_Id = ((TextBox)ddgrnstatus.FooterRow.FindControl("P_displayId")).Text;
            string ProdName = ((TextBox)ddgrnstatus.FooterRow.FindControl("ProductName")).Text;
            string MaxQty = ((TextBox)ddgrnstatus.FooterRow.FindControl("MaxQty")).Text;
            string MinQty = ((TextBox)ddgrnstatus.FooterRow.FindControl("MinQty")).Text;
            string ReorderQty = ((TextBox)ddgrnstatus.FooterRow.FindControl("ReorderQty")).Text;
            string Qtyonhand = ((TextBox)ddgrnstatus.FooterRow.FindControl("qtyonhand")).Text;       
        }
}

推荐答案

您必须做错了什么.完整的代码不在这里,所以...

看看这些文章:
NewRow GridView [ ASP.NET 2.0的GridView示例:在页脚中显示摘要数据 [
You must be doing something wrong. Full code is not here so...

Have a look at these articles:
NewRow GridView[^]
GridView Examples for ASP.NET 2.0: Displaying Summary Data in the Footer[^]



您正在动态添加网格视图行....如果您尝试在网格中编辑新行数据,则将丢失该行数据,因为页面加载正在发生,并且动态添加的行数据将不存在,因为您没有保留任何内容在哪里....所以我的建议是将您在页面初始化中动态添加的数据存储在页面加载中而不是页面加载中,因为您不会在页面加载中获取该数据.....如果我错误地理解了您的问题... sory dude

请让我知道这是否有用

问候
Vinay
Hi
You are adding the grid view row dynamically....if you are trying to edit a row in grid the new row data you will lose because the page load is happening and the dynamically added row data wont be there becauser you are not priserving any where....so my suggetion is store the data what you have added dynamically in page init not in page load because you won''t get that data in page load.....if i understand u r problem wrongly...sory dude

Please let me know if this is usefull

Regards
Vinay


这篇关于在可编辑Gridview的页脚处添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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