I have a GridView that gets the data from a StoreProcedure in SQL. now I want to update some field in that grid. how can I update that ?
my table, view and also StoreProcedure is shown below:
my view is:
SELECT dbo.EDU_Person.FirstName, dbo.EDU_Person.LastName, dbo.EDU_Student1.PersonId, dbo.EDU_Lesson2.Title, dbo.EDU_Student1.code, dbo.EDU_Lesson2.Mark
FROM dbo.EDU_Student1
INNER JOIN dbo.EDU_Person ON dbo.EDU_Student1.PersonId = dbo.EDU_Person.Id
INNER JOIN dbo.EDU_Lesson2 ON dbo.EDU_Student1.Id = dbo.EDU_Lesson2.StudentId
And my SP is:
Create Procedure myproc @id int
As
select * from View_Sample
where PersonId=@id
the GridView code is:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="455px">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="PersonId" HeaderText="PersonId" SortExpression="PersonId" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="code" HeaderText="code" SortExpression="code" />
<asp:BoundField DataField="Mark" HeaderText="Mark" SortExpression="Mark" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="myproc" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="id" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
Now how can I update the Mark field in my gridview and update the EDU_Lesson2 ?