all fields not updating in gridview

I have a gridview where one of the editable fields is not updating.  The EditItemTemplate is a drop down list.  The other text fields are updating just fine.

 Here is the grid view:

 

 <asp:GridView ID="grdTables" runat="server" AutoGenerateColumns="False" DataSourceID="dsTables" Visible="False" BorderStyle="None" CellPadding="5" DataKeyNames="tableCreator,tableName" AllowSorting="True" AllowPaging="True" PageSize="40">
        <Columns>
            <asp:BoundField DataField="tableCreator" HeaderText="Table Creator" Visible="False" ReadOnly="True"/>
            <asp:TemplateField HeaderText="Table Name" SortExpression="tableName">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkTableName" runat="server" NavigateUrl='<%# formatTableURL(Eval("tableName"), Eval("tableCreator")) %>'
                        Text='<%# Eval("tableName") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="tsName" HeaderText="Table Space" ReadOnly="True" />
            <asp:TemplateField HeaderText="Type">
                <EditItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# formatType(Eval("type")) %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# formatType(Eval("type")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>         
            <asp:TemplateField HeaderText="Owner" SortExpression="appOwner">
                <EditItemTemplate>
                    <asp:DropDownList ID="cmbAppOwner" runat="server" 
                        DataSourceID="dsLimitAppOwners" DataTextField="apName" 
                        DataValueField="apID" AppendDataBoundItems="True">
                    <asp:ListItem>Please Select an Application Owner</asp:ListItem></asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# formatAppOwner(Eval("appOwner")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Description">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Rows="5" Text='<%# Bind("description") %>'
                        TextMode="MultiLine"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("description") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
            <HeaderTemplate>
                <a href="../DataDictionary/classification.aspx" target="_blank">Classification</a>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblClassification" runat="server" Text='<%# formatClassification(Eval("tableName"), Eval("tableCreator")) %>'
                    BackColor='<%# getColor(formatClassification(Eval("tableName"), Eval("tableCreator"))) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField EditImageUrl="Images/edit.gif" ShowEditButton="True" ButtonType="Image" CancelImageUrl="Images/cancel.gif" UpdateImageUrl="Images/update.gif" HeaderText="Edit" >
            </asp:CommandField>
        </Columns>
        <HeaderStyle CssClass="gridRegHeader" />
        <PagerSettings PageButtonCount="20" Position="TopAndBottom" />
     </asp:GridView>

 

And the datasource for that gridview with the update command:

 

<asp:SqlDataSource ID="dsTables" runat="server"
            ProviderName="System.Data.SqlClient"
            OldValuesParameterFormatString="old_{0}"
            ConflictDetection="CompareAllValues"
            UpdateCommand="UPDATE dbo.dataTable SET appOwner = @appOwner, description = @description WHERE tableCreator = @old_tableCreator and tableName = @old_tableName">
            <UpdateParameters>
                <asp:Parameter Name="appOwner" />
                <asp:Parameter Name="description" />
                <asp:Parameter Name="tableCreator" />
                <asp:Parameter Name="tableName" />
            </UpdateParameters>
</asp:SqlDataSource>

  

Any idea why the drop down is the only one not updating?

Thanks in advance.
 

 

Read More

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s