[英]Grid View - Binding Data with Data Source at Button Click But Grid is not appearing
I have a GridView
in UpdatePanel
. 我在
UpdatePanel
有一个GridView
。 On button click event I am binding data with Grid view. 在按钮单击事件上,我正在使用Grid视图绑定数据。 Data is being binded properly but Grid is not showing.
数据已正确绑定,但未显示网格。
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindData();
}
}
protected void bindData()
{
// dv is my data view have rows and columns
GridView1.DataSource = dv;
GridView1.DataBind();
UpdatePanel.Update();
}
}
On Button Click Event :- 按键单击事件:-
protected void btnUpdateExtensions_Click(object sender, EventArgs e)
{
// dv is data view have data with columns and rows
GridView1.DataSource = dv;
GridView1.DataBind();
UpdatePanel.Update();
}
At page load its binding data properly ad showing GridView
but at button Click Event its not showing GridView while data source is from same source. 在页面加载时,其绑定数据正确显示为
GridView
但在单击事件时,如果数据源来自同一源,则其不显示GridView。
Your button is inside of updatepanel
then just call 您的按钮位于
updatepanel
内部,然后调用
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
your button and gridview
</asp:UpdatePanel
protected void btnUpdateExtensions_Click(object sender, EventArgs e)
{
bindData();
}
No need to write UpdatePanel.Update(); 无需编写UpdatePanel.Update();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.