问题
Is it possible to set the datasource of a datagrid view using ajax? My objective is to bind a datagrid on clicking a hyperlink(in the same page). Please help.
回答1:
You should use LinkButton
Instead
protected void LinkButton1_Click(object sender, EventArgs e)
{
// set DataSource here .....
}
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%-- GridView--%>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
来源:https://stackoverflow.com/questions/7200234/bind-datagrid-using-ajax