Delete from Datagrid without Viewstate?

J

Jonah Olsson

Hi guys,

How can I change the following code to work without using Viewstate?

Thanks
Jonah

** file.aspx **
<asp:datagrid ID="dgEmails" runat="server"
Width="95%"
HorizontalAlign="Center"
GridLines="None"
AutoGenerateColumns="false"
EnableViewState="false">
<alternatingitemstyle BackColor="#FFFFFF"></alternatingitemstyle>
<itemstyle BackColor="#EEEEEE"></itemstyle>
<columns>
<asp:boundcolumn HeaderText="E-mail"
HeaderStyle-CssClass="contentHeader" DataField="email" ItemStyle-Width="180"
/>
<asp:templatecolumn ItemStyle-Width="50"
ItemStyle-HorizontalAlign="right">
<itemtemplate>
<asp:LinkButton id="lnkDelete" CssClass="greyWhiteBox"
runat="server" CommandName="Delete" Text='<%# Localize.GetString("DELETE")
%>' CausesValidation="false" />
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>

** file.aspx.vb **
Sub dgEmails_Delete(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgEmails.DeleteCommand

Dim Email As String = e.Item.Cells(0).Text
Dim GroupID As Integer = Request.Params("GroupID")
Dim result As Integer

result = MemberManagement.DeleteEmail(Email, GroupID)

lblMessage.Text = "Record deleted"

BindData()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top