View Single Post
  #1 (permalink)  
Old May 16th, 2007, 02:24 AM
kangarolf kangarolf is offline
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Missing parameters in Datagrid .net 2

Hi all,

I have a problem in that in my datagrid any datakeys which are not visible and editable in the datagrid (if the column visibility is set to false or readonly is set to true) do not seem to be passed back to the script and are unavailable as parameters for my updatecommand.

I have tried with and without OldValuesParameterFormatString and ConflictDetection in the sqlSatasource. Any ideas.? Source below.

Thanks

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="true" %>
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.grid {width:550px; border:1px solid;}
.grid td {vertical-align: top; }
.grid th {background-color:#0099FF; color:#FFFFFF;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>


<asp:GridView ID="grdOrders" AutoGenerateColumns="false" runat="server" DataKeyIds="OrderID,AmazonID" DataSourceId="srcOrders" CssClass="grid" autogenerateeditbutton="true" GridLines="Horizontal">

    <Columns>

    <asp:Boundfield DataField = "OrderID" HeaderText="OrderID" readonly="true"/>

    <asp:TemplateField HeaderText="IT Buy Address">
    <ItemTemplate>
    <%# Eval("add1") & "<br/>" & Eval("add2") & "<br/>" & Eval("add3") & "<br/>" & Eval("city") & "<br/><strong>" & Eval("postcode") & "</strong>" %>
    </ItemTemplate>
    </asp:TemplateField>


    <asp:TemplateField HeaderText="Amazon Address">
    <ItemTemplate>
    <%# Eval("AOshipadd1") & "<br/>" & Eval("AOshipadd2") & "<br/>" & Eval("AOshipadd3") & "<br/>" & Eval("AOshipcity") & "<br/><strong>" & Eval("AOshippostcode") & "</strong>" %>
    </ItemTemplate>

    <edititemtemplate>

    <asp:TextBox
    id="AOshipadd1"
    text='<%# Bind("AOshipadd1")%>'
    runat="server" />
    <asp:TextBox
    id="AOshipadd2"
    text='<%# Bind("AOshipadd2")%>'
    runat="server" />
    <asp:TextBox
    id="AOshipadd3"
    text='<%# Bind("AOshipadd3")%>'
    runat="server" />
    <asp:TextBox
    id="AOshipcity"
    text='<%# Bind("AOshipcity")%>'
    runat="server" />
    <asp:TextBox
    id="AOshippostcode"
    text='<%# Bind("AOshippostcode")%>'
    runat="server" />


    </edititemtemplate>


    </asp:TemplateField>

    <asp:Boundfield DataField = "ParcelNum" HeaderText="City Link ID" />


    </Columns>

    </asp:GridView>


<asp:SqlDataSource
id="srcOrders"
ConnectionString="MYConnString"

SelectCommand="Select * from Orders"
UpdateCommand="UPDATE ORders SET ParcelNum = @Parcelnum Where (OrderID = @OrderID); UPDATE OTHER_ORDER_REPORT Set [ship-address-1] = @AOshipadd1 Where [order-id] = @AmazonID"
Runat="server" />
</div>
</form>

</body>
</html>