<asp:UpdatePanel ID="udpAJAXHelp" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:GridView ID="grvDepartment" runat="server" OnRowCommand="grvDepartment_RowCommand" OnRowDeleting="grvDepartment_RowDeleting">
<Columns>
...
<asp:TemplateField HeaderText="Operation">
<ItemTemplate>
<asp:LinkButton ID="lkDelete" runat="server" CommandArgument='<%# Eval("Id") %>' CommandName="Delete" Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnTrigger" />
</Triggers>
</asp:UpdatePanel>
...
<input id="btnTrigger" value="Add" runat="server" type="button" onserverclick="BtnTrigger_Click" />
...
<asp:ListBox ID="lbCategories" runat="server" SelectionMode="Multiple"></asp:ListBox>
Above all are in the ascx file,When I add the control to the Module,I selected the CheckBox 'Supports Partial Rendering?',just like this:http://www.datasprings.com/Resources/ArticlesInformation/AJAXwDotNetNuke/tabid/815/ItemId/91/language/en-US/Default.aspx
In my scenario,I select one item in the ListBox 'lbCategories',and press the Button 'btnTrigger',the item will be added to the GridView 'grvDepartment' and deleted from the ListBox.The adding action and the deleting action are done in the behind code.
try
{
...
//bind data
BindGridView();//get data from the DB and bind to the GridView
BindListBox();//get date from the DB and bind to the ListBox
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException(this, ex);
}
This process is perfect,the effect of DNN Ajax which make the GridView and the ListBox partial postback is good.And next what I want to is to delete a item from the GridView and add it to the ListBox.The code is
protected void grvDepartment_RowCommand(object sender, GridViewCommandEventArgs e)
{
...
switch (e.CommandName)
{
case "Delete":
...
FillGrid();
FillCategories();
break;
}
}
I find the GridView is refreshed,but the ListBox is not refreshed,unless I refresh the page.That means the ListBox is not postbacked partially.
Any advice will be appreciated.
Jed