Refresh SPGridView

Hi,

I have a SPDatasource and a SPGridView in an item edit form. I want to add a button inside the form to click to refresh the SPGridView. Can anyone suggest how to achieve that? Thanks.

<asp:Button runat="server" Text="Button" id="Button1" ></asp:Button>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="TRUE">
<ContentTemplate>
<SharePoint:SPGridView runat="server" ID="GridView1" EnableViewState="true" AutoGenerateColumns="False" BorderWidth="0px" CellPadding="1" BorderStyle="None" DataSourceID="spdatasource1"><AlternatingRowStyle CssClass="ms-alternating" />
<HeaderStyle Wrap="False" BackColor="Black" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
<Columns>
<SharePoint:SPboundfield DataField="Created" HeaderText="Event Log Date" SortExpression="Created" />							<SharePoint:SPboundfield DataField="Author" HeaderText="Created By" SortExpression="Author" />							<SharePoint:SPboundfield DataField="Desciption" HeaderText="Event Log Description" SortExpression="Desciption" />
</Columns>
<SelectedRowStyle CssClass="ms-selectednav" Font-Bold="True" /></SharePoint:SPGridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

  • Edited by karen0123456789 Friday, November 01, 2013 3:01 AM Added code block
October 31st, 2013 1:19pm

You can add template column in grid view and add a refresh button.
Free Windows Admin Tool Kit Click here and download it now
October 31st, 2013 2:06pm

Hi Bala,

Sorry for late reply. I have try to add a button for refresh. When the button is clicked, the GridView will show no results.

November 1st, 2013 4:44am

Are you refreshing the grid on postback? Please post your code behind file here.
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2013 6:49am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics