Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 16th, 2007, 02:24 AM
Registered User
Join Date: May 2007
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.


<%@ 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;}
<form id="form1" runat="server">

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


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

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

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


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



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




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" />


Old May 17th, 2007, 03:33 AM
Registered User
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts


Hi all, My problem was that I had a few joins in my initial table and was using table aliases (tablealias.columnname, tablealias2.column2 etc) and this threw off the connection between DataNameIds declared in the datagrid and the columns in the sql data source, so that no parameter was created with the names defined in the DataNameIds. No error was raised either!?!

Once the keyword AS was used for the relevant columns (tablesalias.column AS column) everything was hunky dorey again. This is not a problem once if the column is databound and visible or editable, in those instances it ignores the table alias.


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid/Hyperlink w multiple parameters gobotsoup ASP.NET 2.0 Basics 11 February 21st, 2007 05:49 PM
problems with multiple parameters and datagrid gobotsoup General .NET 0 February 16th, 2007 05:08 PM
missing directive with simple datagrid pbarbalias ASP.NET 1.0 and 1.1 Basics 1 October 17th, 2006 07:48 PM
Passing more than one parameters from datagrid Lyn ASP.NET 1.0 and 1.1 Professional 6 August 29th, 2006 02:30 AM
Multiple parameters for a datagrid jgsuter ASP.NET 2.0 Professional 1 June 14th, 2006 09:31 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.