Gridview Updatecommand ControlParameter Problem

Discussion in 'ASP .Net' started by Lee Moore, Aug 18, 2005.

  1. Lee Moore

    Lee Moore Guest

    I have the following code, which I thought should work. I get an error
    stating ...

    Could not find control 'GOAL_TEXT_CONTROL' in ControlParameter 'GOAL_TEXT'.

    Any help would be great.

    <-------------------------- Code Snippet --------------------------->

    <asp:GridView ID="GridView1" Runat="server"
    DataSourceID="SqlDataSource1" DataKeyNames="GOAL_ID"
    HeaderStyle-BackColor="#707070"
    HeaderStyle-ForeColor="#FFFFFF"
    FooterStyle-BackColor="#707070"
    FooterStyle-ForeColor="#FFFFFF"
    BorderColor="Tan"
    CellPadding="2" BackColor="LightGoldenrodYellow"
    BorderWidth="1px" ForeColor="Black"
    AutoGenerateColumns="False" ShowFooter="True">


    <Columns>
    <asp:CommandField ShowEditButton="True" />
    <asp:TemplateField>
    <EditItemTemplate>
    <input id="GOAL_ID" type="checkbox" runat="server"
    value='<%# Eval("GOAL_ID") %>' />
    </EditItemTemplate>

    <ItemTemplate>
    <input id="GOAL_ID" type="checkbox" runat="server"
    value='<%# Eval("GOAL_ID") %>' />
    </ItemTemplate>
    </asp:TemplateField>

    <asp:TemplateField>
    <HeaderTemplate>
    Goal
    </HeaderTemplate>
    <EditItemTemplate>
    <asp:TextBox ID="GOAL_TEXT_CONTROL" Value='<%#
    Eval("GOAL_TEXT") %>' Runat="server"></asp:Textbox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="GOAL_TEXT_CONTROL"
    Runat="Server"><%# Eval("GOAL_TEXT") %></asp:Label>
    </ItemTemplate>
    <FooterTemplate>
    <asp:TextBox ID="GOAL_TEXT_CONTROL"
    Runat="server"></asp:Textbox>
    </FooterTemplate>
    </asp:TemplateField>

    <asp:TemplateField>
    <FooterTemplate>
    <input id="CYCLE_ID_CONTROL" type=hidden
    Value='<%#session("CYCLE_ID")%>' runat="server">
    <asp:Button ID="Button1" Runat="server" Text="Add"
    OnClick="Button1_Click" />
    <asp:Button ID="DeleteSelectedRows"
    OnClick="DeleteSelectedRows_Click" runat="server" Text="Del" />
    </FooterTemplate>
    </asp:TemplateField>

    <asp:TemplateField>
    <FooterTemplate>
    <input id="DEPT_ID_CONTROL" type=hidden
    Value='<%#session("DEPT_ID")%>' runat="server">
    </FooterTemplate>
    </asp:TemplateField>

    </Columns>

    </asp:GridView>


    <asp:SqlDataSource ID="SqlDataSource1" Runat="server"
    InsertCommand="INSERT INTO [IEP_GOALS] ([CYCLE_ID], [DEPT_ID],
    [GOAL_TEXT]) VALUES (@CYCLE_ID, @DEPT_ID, @GOAL_TEXT)"
    SelectCommand="SELECT [GOAL_ID], [CYCLE_ID], [DEPT_ID],
    [GOAL_TEXT] FROM [IEP_GOALS]"
    DeleteCommand="DELETE FROM [IEP_GOALS] WHERE [GOAL_ID] =
    @GOAL_ID"
    UpdateCommand="UPDATE [IEP_GOALS] SET [GOAL_TEXT] = @GOAL_TEXT
    WHERE GOAL_ID=@GOAL_ID"
    ConnectionString="server=sqlserver;user=sa;password=password;database=IEP_DATA;">
    <UpdateParameters>
    <asp:ControlParameter Name="GOAL_TEXT"
    ControlId="GOAL_TEXT_CONTROL" PropertyName="Text"/>
    <asp:ControlParameter Name="GOAL_ID" ControlId="GOAL_ID"
    PropertyName="Text"/>
    </UpdateParameters>

    <DeleteParameters>
    <asp:parameter Name="GOAL_ID" Type = "Int32"/>
    </DeleteParameters>

    <InsertParameters>
    <asp:parameter Type="String"
    Name="CYCLE_ID"></asp:parameter>
    <asp:parameter Type="String" Name="DEPT_ID"></asp:parameter>
    <asp:parameter Type="String"
    Name="GOAL_TEXT"></asp:parameter>
    </InsertParameters>
    </asp:SqlDataSource>
    Lee Moore, Aug 18, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. K B
    Replies:
    3
    Views:
    8,100
    Shawn Wildermuth
    Jul 16, 2006
  2. Mark
    Replies:
    0
    Views:
    404
  3. Replies:
    2
    Views:
    2,166
  4. srathin

    DataGrid1 UpdateCommand calling DataGrid2 UpdateCommand

    srathin, Apr 9, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    174
    srathin
    Apr 9, 2005
  5. srathin

    DataGrid1 UpdateCommand calling DataGrid2 UpdateCommand

    srathin, Apr 9, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    158
    srathin
    Apr 11, 2005
Loading...

Share This Page