Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to update a ListBox using a Buttion which is contained in a GridView using DNN AjaxHow to update a ListBox using a Buttion which is contained in a GridView using DNN Ajax
Previous
 
Next
New Post
2/16/2008 2:56 AM
 

<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

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to update a ListBox using a Buttion which is contained in a GridView using DNN AjaxHow to update a ListBox using a Buttion which is contained in a GridView using DNN Ajax


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out