Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 957439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:42:01+00:00 2026-05-16T00:42:01+00:00

I had grid view which bind sql data source and added field to update

  • 0

I had grid view which bind sql data source and added field to update data in grid view but it did not do any update and no error appeared and I did not know where the error

SQL Stored Procedures:

ALTER proc [dbo].[GetNewswithType]
As
Begin
Select News.Id,News.Type_Id,
News.Header,News.HText,News.DText,News.Active,News.Add_Date,
NewsType.Type_AR,NewsType.Type_EN
From News
Inner Join NewsType On 
NewsType.Id=News.Type_Id
End  

ALTER Proc [dbo].[UpdateNews]
(
@Id Int
,@Header Nvarchar(50)
,@HText Nvarchar(Max)
,@DText  Nvarchar(Max)
,@Type_Id Int
,@Active Bit

)
AS
BEGIN 
Update News Set 

@Header =Header 
,@HText =HText 
,@DText  =DText 
,@Type_Id=Type_Id
,@Active =Active 

WHERE @Id=Id
END

ASPX Page:

<div class="m10">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" DataKeyNames="Id" DataSourceID="SDSNews" ForeColor="Black" 
        GridLines="Vertical" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" 
        onselectedindexchanging="GridView1_SelectedIndexChanging" 
            onpageindexchanging="GridView1_PageIndexChanging" AllowPaging="True" 
            onrowupdated="GridView1_RowUpdated" 
            onrowdatabound="GridView1_RowDataBound">
        <FooterStyle BackColor="#CCCC99" />
        <RowStyle BackColor="#F7F7DE" />
        <Columns>
            <asp:CommandField HeaderText="Function" ShowEditButton="True" />
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" 
                Visible="False" />
            <asp:BoundField DataField="Header" HeaderText="Header" 
                SortExpression="Header" />
            <asp:BoundField DataField="HText" HeaderText="HomeText" 
                SortExpression="HText" />
            <asp:BoundField DataField="DText" HeaderText="DetailsText" 
                SortExpression="DText" />
            <asp:BoundField DataField="Type_Id" HeaderText="TypeNumber" 
                SortExpression="Type_Id" />
            <asp:BoundField DataField="Type_AR" HeaderText="Type_AR" 
                SortExpression="Type_AR" InsertVisible="False" ReadOnly="True" />
            <asp:BoundField DataField="Type_EN" HeaderText="Type_EN" 
                SortExpression="Type_EN" InsertVisible="False" ReadOnly="True" />
            <asp:CheckBoxField DataField="Active" HeaderText="Active" 
                SortExpression="Active" />
            <asp:BoundField DataField="Add_Date" HeaderText="Add_Date" 
                SortExpression="Add_Date" InsertVisible="False" ReadOnly="True" />
        </Columns>
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
        <asp:SqlDataSource ID="SDSNews" runat="server" 
            ConnectionString="Data Source=ELARABY-1EACFA3\SQLEXPRESS;Initial Catalog=ElarabyGroup;Integrated Security=True" 
            ProviderName="System.Data.SqlClient" SelectCommand="GetNewswithType" 
            SelectCommandType="StoredProcedure" UpdateCommand="UpdateNews" 
            UpdateCommandType="StoredProcedure">
            <UpdateParameters>
                <asp:ControlParameter ControlID="GridView1" Name="Id" 
                    PropertyName="SelectedValue" Type="Int32" />
                <asp:ControlParameter ControlID="GridView1" Name="Header" 
                    PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="GridView1" Name="HText" 
                    PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="GridView1" Name="DText" 
                    PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="GridView1" Name="Type_Id" 
                    PropertyName="SelectedValue" Type="Int32" />
                <asp:ControlParameter ControlID="GridView1" Name="Active" 
                    PropertyName="SelectedValue" Type="Boolean" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:42:02+00:00Added an answer on May 16, 2026 at 12:42 am

    Add some code to your update procedure to determine if it’s being called:

    1. Create a table called Logging (or any name of your choice) that has a column called Message (again, or any name of your choice)
    2. Add a line to your UpdateNews procedure to INSERT INTO [dbo].[Logging] (Message) VALUES ('Procedure Called'). You could log the values of the parameters passed in, if you so wished.

    By doing this you can determine if the stored procedure is actually being called or not. The other option is to use Sql Server Profiler to determine this. If you can determine that it is calling the stored procedure, then something is going wrong in there and by logging the parameters you can “hand call” it to find out why.

    More likely is that the stored procedure is never being called, how are you telling the grid to persist the changes back out to the database? Looking at this tutorial, I would suggest that your updates are not triggering a “save”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had grid view which retrieved data from database and mad update for specific
I had developed an album app in which I am using grid View. The
I had Grid view and I added property allow sorting in it and I
I had a question in MySQL, did it correctly. But the book code differs
I had Gridview bind sqldatasource and I had logins which see gridview and I
I had gridview which in load it will get data from database .And I
I have a SQLite database that is displayed in a data grid view in
In extjs3 Ext.grid.View had a config property forceFit . What is the equivalant to
I had gridview which get data from database according to two event .The first
I had gridview which retriev data from database and filter this gridview when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.