Gridview update not working (2.0)

J

JoanneB

I'm pretty new to dot net and we run v 2.0. I sucessfully made a gridview and
can edit, but when I click Update, the changes aren't made. There is no error
raised. Very frustrating.

I looked on this newsgroup and all over the web, but I haven't found the
answer. I saw something about update not being created correctly by the GUI,
but I typed my own in the source code. I'll include it, if anyone wants to
dig through. Thanks in advance if you do!

<asp:GridView ID="gdvLobbying" runat="server"
AutoGenerateColumns="False" Width="1084px" EmptyDataText="No data
found" DataSourceID="SqlDataSourceLobbying" AutoGenerateEditButton="True"
DataKeyNames="id">
<Columns>
<asp:BoundField DataField="Year" HeaderText="Year"
SortExpression="Year" />
<asp:TemplateField HeaderText="Quarter" SortExpression="Quarter">
<EditItemTemplate>
<asp:dropdownlist ID="ddlQuarter" runat="server"
DataSourceID="SqlDataSourceQuarters" DataTextField="quarter" Text='<%#
Bind("Quarter") %>'></asp:dropdownlist>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Quarter") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Bill" HeaderText="Bill"
SortExpression="Bill" />
<asp:BoundField DataField="Category" HeaderText="Category"
SortExpression="Category" />
<asp:BoundField DataField="Agency" HeaderText="Agency"
SortExpression="Agency" />
<asp:BoundField DataField="StaffName" HeaderText="StaffName"
SortExpression="StaffName" />
<asp:BoundField DataField="OtherCategory"
HeaderText="OtherCategory" SortExpression="OtherCategory" />
<asp:BoundField DataField="Revised" HeaderText="Revised"
SortExpression="Revised" />
<asp:BoundField DataField="positioncode"
HeaderText="positioncode" SortExpression="positioncode" />
<asp:BoundField DataField="id" HeaderText="ID" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSourceLobbying" runat="server"
ConnectionString="<%$ ConnectionStrings:Lobby %>"
SelectCommand="SELECT [Year], [Quarter], [Bill], [Category],
[Agency], [StaffName], [OtherCategory], [Revised], positioncode, ID FROM
[tblLobbying] where [positionCode]=@position ORDER BY [Year], [Quarter]"
UpdateCommand="UPDATE tblLobbying SET [year]=@year,
[Quarter]=@quarter, [Bill]=@bill, [Category]=@category, [Agency]=@agency,
[OtherCategory]=@OtherCategory, [Revised]=@revised where [id]=@id">
<SelectParameters>
<asp:SessionParameter Name="position" SessionField="position" />
</SelectParameters>
<UpdateParameters >
<asp:SessionParameter Name="position" SessionField="position" />
<asp:SessionParameter Name="lanid" SessionField="lanid" />
<asp:SessionParameter Name="revised" DefaultValue="<%now()%>"/>
</UpdateParameters>
</asp:SqlDataSource>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top