I have bounded Gridview through Wizard. It's working fine. but i want that if i add new data it should be visible in the gridview. But gridview not refreshing. I know i can perform this programmat开发者_StackOverflowically . but i want to do it in this case also.
Any help will be appreciated. thanks
in the action method of the Save button of your add from data, add this
dataGridView.DataBind();
Try placing the GridView within an UpdatePanel and setting the GridView to AutoPostBack="true". set the UpdatePanel trigger to the ID of the add button you use to add new data to the gridview
<asp:UpdatePanel>
<ContentTemplate>
<asp:Gridview ID="grid" AutoPostBack="true">
<asp:TemplateField>
<ItemTemplate>
<button id="btnID" type="button" class="btn btn-info btn-primary btn-lg" data-toggle="modal" data-target="#splitModal" style="width:115px;">Split Record</button>
</ItemTemplate>
</asp:TemplateField>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnID" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
精彩评论