Welcome to Dream.In.Code
Become an Expert!

Join 150,187 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,078 people online right now. Registration is fast and FREE... Join Now!




Gridview Passing Null To Delete Method

 
Reply to this topicStart new topic

Gridview Passing Null To Delete Method

pintoca
13 Sep, 2008 - 04:11 PM
Post #1

New D.I.C Head
*

Joined: 13 Sep, 2008
Posts: 1

Hi,

I have 3 methods defined, getdata, updatedata and deletedata.
The get and update are working fine, all row parameters are passed to the update method, the problem is that when the delete is selected only null is passed.
I'm using the design GridView and objectdatasource

CODE


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ccc.aspx.cs" Inherits="ccc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1"
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
        DeleteMethod="DeleteData" SelectMethod="GetData" TypeName="Database">
        <DeleteParameters>
            <asp:Parameter Name="AlarmID" Type="String" />
<asp:Parameter Name="Changed" Type="Boolean"></asp:Parameter>
            <asp:Parameter Name="sysname" Type="String" />
            <asp:Parameter Name="AlarmType" Type="String" />
            <asp:Parameter Name="AlarmText" Type="String" />
            <asp:Parameter Name="SNMP" Type="Boolean" />
            <asp:Parameter Name="SMS" Type="Boolean" />
            <asp:Parameter Name="Email" Type="Boolean" />
            <asp:Parameter Name="TableName" Type="String" />
        </DeleteParameters>
        <SelectParameters>
            <asp:Parameter DefaultValue="" Name="sysname" Type="String" />
            <asp:Parameter DefaultValue="%" Name="TextToFind" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </form>
</body>
</html>


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 04:08AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month