在GridView中显示数据 [英] displaying data in gridview
问题描述
我有一个数据网格..其中有更新和删除列..我以自定义方式做到了
在同一页面上,我有一个文本框和addcatagory按钮.即
添加类别(文本框)
并添加类别Button
我用bind()绑定数据以显示在网格中.
我用
i have a datagrid.. having update and delete column in it.. i did it in a custom way
and on the same page i have a textbox and addcatagory button.. i.e
add catagory ( text box)
and add category Button
i used bind() to bind the data to show in grid..
i used
if (!IsPostBack)
{
bind();
}
但是问题是当我添加类别时..网格没有显示新添加的数据,即使我刷新页面也是如此.
但是,当我关闭页面并再次通过Visual Studio运行页面时,它运行正常..
当我删除!IsPostBack时,刷新时可以看到网格中的数据.但是在删除和升级行时出现问题.我正在使用网格视图....
我必须要做的,以便当我添加gridview时,可以将gridview中的数据视为驴子..
but the problem is that when i add category.. the grid is not showing the newly added data that data even i refresh the page.
but when i close the page and run the page again thorough visual studio.. it runs fine..
when i remove !IsPostBack then data is in grid can be seen on refresh. but problems occour on row deleting and upldation. that i am doing with grid view....
what i have to do so that data in gridview can bse seen ass son as i add it..
推荐答案
有几种方法可以更新网格中的数据,但是您在Textbox中使用,请尝试以下代码
response.redirect("currentpage.aspx");或
Response.Redirect(Request.Url.AbsoluteUri);
There is several way to update data in grid, But you use in Textbox so try this code
response.redirect("currentpage.aspx"); or
Response.Redirect(Request.Url.AbsoluteUri);
要进行更新,可以使用querystring
或使用columnofgrid =((((textbox).gridview.row [e.editindex] .cells [0] .controls [0]).text);
For updating u can use querystring
or use columnofgrid=(((textbox).gridview.row[e.editindex].cells[0].controls[0]).text);
在之后使用bind()方法更新和删除...
use bind() method after Updation And Deletion...
这篇关于在GridView中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!