Update record in ASp.Net GridView using SqlDataSource

Last Reply 5 months ago By pandeyism

Posted 5 months ago

I have a Dropdown list that user can select the Date and time by using them for Updating the value of GridView.

this is my Grid view:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
    <Columns>
        <asp:CommandField ShowSelectButton="True" />
        <asp:BoundField DataField="ExamDate" HeaderText="ExamDate" SortExpression="ExamDate" />
        <asp:BoundField DataField="ExamTime" HeaderText="ExamTime" SortExpression="ExamTime" />
    </Columns>
</asp:GridView>

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:kduisdbConnectionString %>" SelectCommand="SELECT [ExamDate], [ExamTime] FROM [EDU_Course]"></asp:SqlDataSource>

I actually want to edit the date and time field of my gridview. What is the best way to do Update the date and Time of Gridview field?

How can I do this in asp.net?