Question

I am updating the table in database by entering some fields in same page containing INPUT fields and Grid. but grid which is connected to that table is not refreshing after submit the value. I have to open that page in new tab to view the changes. Also i want those input fields empty after submit.

               <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:con %>" 
                ProviderName="<%$ ConnectionStrings:con.ProviderName %>" 
                SelectCommand="SELECT * FROM [View_Intakesheet]" 
                InsertCommand="INSERT INTO [View_Intakesheet] [date_withdrawn], [date_delivered], [qc_by], [qc_date], [additional_notes], [Case_Status_Text], [Case_Type_Text]) VALUES (@date_withdrawn, @date_delivered, @qc_by, @qc_date, @additional_notes, @Case_Status_Text, @Case_Type_Text)" 
                UpdateCommand="UPDATE intakesheet SET date_withdrawn= @date_withdrawn, date_delivered= @date_delivered, qc_by = @qc_by,  qc_date=@qc_date, additional_notes = @additional_notes WHERE (case_number = @case_number)">
                   <InsertParameters>
                    <asp:Parameter Name="date_withdrawn" />
                    <asp:Parameter Name="date_delivered" />
                    <asp:Parameter Name="qc_by" />
                    <asp:Parameter Name="qc_date" />
                    <asp:Parameter Name="additional_notes" />
                    <asp:Parameter Name="Case_Status_Text" />
                </InsertParameters>
                <SelectParameters>
                    <asp:SessionParameter Name="assigned_to" SessionField="Name" Type="String" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="case_status" />
                    <asp:Parameter Name="date_withdrawn" />
                    <asp:Parameter Name="date_delivered" />
                    <asp:Parameter Name="qc_by" />
                    <asp:Parameter Name="qc_date" />
                    <asp:Parameter Name="additional_notes" />
                    <asp:Parameter Name="case_number" />
                    <asp:Parameter Name="case_type" />
                </UpdateParameters>
            </asp:SqlDataSource>
Was it helpful?

Solution

You can do it by rebinding the gridview like this just after where your update is done.

GridViewIs.DataBind()

OTHER TIPS

You will have to re-bind the grid once you are done with changes. Please let us know if you are doing that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top