GridView在编辑时出现意外行为

GridView在编辑时出现意外行为

本文介绍了GridView在编辑时出现意外行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一些记录绑定到gridview,绑定过程正确完成,并且还添加了用于编辑和删除的命令字段.当我第一次编辑时,所有单元格的值都转到相应的文本框或其他控件,因此编辑工作非常完美.但是问题是当我在gridview中编辑另一条记录时,该行变成了类似于模板字段的文本框.请帮助我.我认为这是意外行为.


看一下屏幕截图,您会得到我的pblm

http://bit.ly/eg1YnS [ ^ ]

http://bit.ly/fEdKOQ [ ^ ]

更新:

I am binding some records to gridview, the binding process is done correctly and also iam adding commandfield for editing and deleting. When i am editing first time all the cell value go to the corresponding textboxes or other controls, editing is worked perfectly. But the problem is that when i am editing another record in the gridview the row become textboxes like template field.Please help me.I think this is an unexpected behaviour.


Look at the screenshot you get what is my pblm

http://bit.ly/eg1YnS[^]

http://bit.ly/fEdKOQ[^]

Update:

public bool Bind(string Query, GridView grdView)
{
 sqlFunc = new DB.SQLFunctions();
 DataTable dTable = sqlFunc.ReturnDataTable(Query);
 grdView.DataSource = dTable;
 grdView.DataBind();
 return true;
 }



这是我只是调用此方法并且bind.iam多次执行此方法的方法.但是无法解决此pblm



This is the method iam just calling this method and bind.iam doing so many times this approach.but this pblm i can''t fix

推荐答案

if (!IsPostback)
{
    //YOUR CODE GOES HERE
    //
    Binding(YOUR_QUERY, gridView);
}



这篇关于GridView在编辑时出现意外行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 11:40