Home All Groups Group Topic Archive Search About

FormView update parameter values

Author
7 Mar 2006 8:50 PM
John Hopper
I have a formView with a sqlDataSource. The sqlDataSource has 2
updateParameters. I can't seem to set the value of one of them from the text
of a textbox in an editTemplate of the formView. Can someone help? Thanks.

<asp:SqlDataSource ID="formSource" runat="server" ConnectionString="<%$
ConnectionStrings:SSConnectionString %>"
            SelectCommand="Select p.Description, p.CurrentStatus,
pu.projUpdate, p.ID From dbo.tblProjects p left outer join tblProjectUpdates
pu on p.id = pu.ProjectID where p.ID = @ID order by projUpdateDate desc"
UpdateCommand="Update [tblProjects] set [Description] = @Description where
[ID] = @ID">
            <SelectParameters>
                <asp:ControlParameter Name="ID" ControlID="GridView1"
PropertyName="SelectedValue" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="Description" />
                <asp:Parameter Name="ID" />
            </UpdateParameters>
        </asp:SqlDataSource>

Author
8 Mar 2006 12:00 AM
Phillip Williams
Make sure that the TextBox markup has a valid Bind statement and that the
GridView DataKeyNames property="ID".
Show quoteHide quote
"John Hopper" wrote:

> I have a formView with a sqlDataSource. The sqlDataSource has 2
> updateParameters. I can't seem to set the value of one of them from the text
> of a textbox in an editTemplate of the formView. Can someone help? Thanks.
>
> <asp:SqlDataSource ID="formSource" runat="server" ConnectionString="<%$
> ConnectionStrings:SSConnectionString %>"
>             SelectCommand="Select p.Description, p.CurrentStatus,
> pu.projUpdate, p.ID From dbo.tblProjects p left outer join tblProjectUpdates
> pu on p.id = pu.ProjectID where p.ID = @ID order by projUpdateDate desc"
> UpdateCommand="Update [tblProjects] set [Description] = @Description where
> [ID] = @ID">
>             <SelectParameters>
>                 <asp:ControlParameter Name="ID" ControlID="GridView1"
> PropertyName="SelectedValue" />
>             </SelectParameters>
>             <UpdateParameters>
>                 <asp:Parameter Name="Description" />
>                 <asp:Parameter Name="ID" />
>             </UpdateParameters>
>         </asp:SqlDataSource>
Author
8 Mar 2006 1:28 PM
John Hopper
Thanks so much. The Bind statement was the problem. I was using Eval. Now it
works fine. Thanks again!

John Hopper

Show quoteHide quote
"Phillip Williams" wrote:

> Make sure that the TextBox markup has a valid Bind statement and that the
> GridView DataKeyNames property="ID".
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "John Hopper" wrote:
>
> > I have a formView with a sqlDataSource. The sqlDataSource has 2
> > updateParameters. I can't seem to set the value of one of them from the text
> > of a textbox in an editTemplate of the formView. Can someone help? Thanks.
> >
> > <asp:SqlDataSource ID="formSource" runat="server" ConnectionString="<%$
> > ConnectionStrings:SSConnectionString %>"
> >             SelectCommand="Select p.Description, p.CurrentStatus,
> > pu.projUpdate, p.ID From dbo.tblProjects p left outer join tblProjectUpdates
> > pu on p.id = pu.ProjectID where p.ID = @ID order by projUpdateDate desc"
> > UpdateCommand="Update [tblProjects] set [Description] = @Description where
> > [ID] = @ID">
> >             <SelectParameters>
> >                 <asp:ControlParameter Name="ID" ControlID="GridView1"
> > PropertyName="SelectedValue" />
> >             </SelectParameters>
> >             <UpdateParameters>
> >                 <asp:Parameter Name="Description" />
> >                 <asp:Parameter Name="ID" />
> >             </UpdateParameters>
> >         </asp:SqlDataSource>