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.0Grid view not refreshing after deleteGrid view not refreshing after delete
Previous
 
Next
New Post
3/20/2008 8:54 PM
 

Newbie help please...

I have a grid view within a multiview panel, with View and Delete buttons added in template form.  In the code-behind I capture the Delete button successfully and am able to delete the record successfully, but the databind to refresh the grid brings up the EmptyDataText message unless I refresh the page entirely!  Can anyone give me a pointer??

Thanks!  Marty

Form code looks like this:

<%@ Control Language="vb" Inherits="CCO.Modules.CCOMemberships.ViewCCOMemberships"
    CodeFile="ViewCCOMemberships.ascx.vb" AutoEventWireup="false" Explicit="True" %>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<asp:ObjectDataSource ID="MembershipObjectDataSource" runat="server" DataObjectTypeName="CCO.Modules.CCOMemberships.CCOMembershipsInfo"
    DeleteMethod="DeleteMembership" InsertMethod="AddMembership" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetMemberships" TypeName="CCO.Modules.CCOMemberships.CCOMembershipsController"
    UpdateMethod="UpdateMembership" OnInit="Page_Load">
    <SelectParameters>
        <asp:Parameter DefaultValue="00" Name="ModuleId" Type="Int32" />
        <asp:Parameter DefaultValue="00" Name="ClubID" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
<center>
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="ShowMemberships" runat="server">
            <center>
                <dnn:Label ID="lblAddMessage" runat="server" ControlName="lblAddMessage" Suffix=":">
                </dnn:Label>
            </center>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" EmptyDataText="There are no memberships in this Club yet."
                HorizontalAlign="Center">
                <Columns>
                    <asp:TemplateField AccessibleHeaderText="Edit" HeaderText="View" ShowHeader="False">
                        <ItemTemplate>
                            <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="false" CommandArgument='<%# Eval("MembershipID") %>'
                                CommandName="Edit_Click" ImageUrl="~/images/view.gif" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField AccessibleHeaderText="Delete" HeaderText="Delete" ShowHeader="False">
                        <ItemTemplate>
                            <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="false" CommandArgument='<%# Eval("MembershipID") %>'
                                CommandName="Delete_Click" OnClientClick="return confirm('Are you sure you want to delete this membership?');" ImageUrl="~/images/delete.gif" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" ReadOnly="True">
                        <ItemStyle HorizontalAlign="Left" Width="250px" />
                    </asp:BoundField>
                </Columns>
            </asp:GridView>
            <br />
            <center>
                <asp:Button ID="AddButton" runat="server" Text="Add Membership" />
            </center>
        </asp:View>
        <asp:View ID="View1" runat="server">
        </asp:View>
    </asp:MultiView>
</center>

 

 

And the code behind looks like this:

 

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
            If e.CommandName.CompareTo("Edit_Click") = 0 OrElse e.CommandName.CompareTo("Delete_Click") = 0 Then
                If e.CommandName.CompareTo("Delete_Click") = 0 Then
                    Dim congID As Integer = Me.UserInfo.Profile.GetPropertyValue("ClubID")
                    Dim memctl As New CCOMembershipsController
                    memctl.DeleteMembers(ModuleId, e.CommandArgument, Me.UserInfo.Profile.GetPropertyValue("ClubID"), Me.UserId)
                    memctl.DeleteMembership(ModuleId, e.CommandArgument, Me.UserInfo.Profile.GetPropertyValue("ClubID"), Me.UserId)
                    GridView1.DataBind()
                End If
            End If
End Sub

Any ideas??

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Grid view not refreshing after deleteGrid view not refreshing after delete


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