How do you programatically update a row in a gridview using a stored procedure.
the above code does not do anything, but its the idea of what Im trying to do.Code:Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click For Each row As GridViewRow In Me.assignmentGridView.Rows Me.assignmentDataSource.Update() 'where the update uses the parameters are defined below in .aspx file Next EndSub
Code:<asp:SqlDataSource ID="assignmentDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:FCRscheduleConnectionString %>" SelectCommand="dayAssignment" SelectCommandType="StoredProcedure" UpdateCommand="dayAssignmentUpdate" UpdateCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="Calendar1" Name="date" PropertyName="SelectedDate" Type="DateTime" /> </SelectParameters> <UpdateParameters> <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" /> <asp:ControlParameter ControlID="Calendar1" Name="date" PropertyName="SelectedDate" Type="DateTime" /> <asp:ControlParameter ControlID="assignmentGridView" Name="fcrID" PropertyName="SelectedValue" Type="Int32" /> <asp:ControlParameter ControlID="assignmentGridView" Name="Site" PropertyName="SelectedValue" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource>




Reply With Quote