Eri*_*ric 2 vb.net asp.net gridview
我有一个仅在模态弹出窗口中显示的gridview.在我调用模态弹出窗口之前,我在文本框中设置了一个值.模态弹出窗口内的gridview取决于该文本框的数据值,以显示它的数据.所以onclick我想重新加载gridview,以便它将使用文本框的值重新加载.有任何想法吗?
基本上......使用更新面板,按钮按下事件应该触发重新运行查询的部分回发,然后允许您在网格上执行另一个数据绑定.这将是一个modalPopUp.Show()...
代码背后
protected void btnAdd_Click(object sender, EventArgs e)
{
if(!String.IsNullOrEmpty(this.txtMyValue.Text))
{
AddValue(this.txtMyValue.Text);
UpdateGrid();
this.UpdatePanel1.Update();
}
else
{
//ooooops
}
}
private void AddValue(String str)
{
DataAccess.AddSomeValue(str);
}
private void UpdateGrid()
{
this.GridView1.DataSource = DataAccess.GetData();
this.GridView1.DataBind();
}
Run Code Online (Sandbox Code Playgroud)
前端
<asp:UpdatePanel ID="UpdatePanel1" runat="server" updatemode="Conditional">
<ContentTemplate>
<asp:TextBox id="TextBox1" runat="server" />
<asp:Button id="btnAdd" OnClick="btnAdd_Click" runat="Server">
<div id="MyModalArea">
<asp:GridView id="GridView1" runat="Server" ..... >
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3482 次 |
| 最近记录: |