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 978627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:05:10+00:00 2026-05-16T04:05:10+00:00

I have a GridView which retrieves data from a database. Users have roles, some

  • 0

I have a GridView which retrieves data from a database. Users have roles, some of the users will update one column in the GridView and others will update a other columns according to roles see the code below!. I created the stored procedures as below and I added code. When I tested the project,with role (AR-Translator)as example after edit column in grid view it replace other fieds with NULL value, so please what I can do?

stored procedure

ALTER Proc [dbo].[GetAllTranslation]
 AS
BEGIN 
  Select Id,Word 
   ,Trans_AR
   ,Trans_EN
   ,Add_Date 
  From Translation 
END

ALTER Proc [dbo].[UpdateTranslation]
(
  @IdINT
  ,@Word NVARCHAR(MAX)
  ,@Trans_AR NVARCHAR(MAX)
  ,@Trans_EN NVARCHAR(MAX)


)
AS
BEGIN 
  UPDATE  Translation SET

  Word =@Word 
  ,Trans_AR=@Trans_AR 
  ,Trans_EN=@Trans_EN 

  WHERE Id=@Id
END

aspx page

 <div class="m10">
  <asp:GridView ID="GridView1" runat="server" BackColor="White" 
    BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
    ForeColor="Black" GridLines="Vertical" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" 
    DataSourceID="SDSTrans" onrowupdated="GridView1_RowUpdated">
    <FooterStyle BackColor="#CCCC99" />
    <RowStyle BackColor="#F7F7DE" />
    <Columns>
        <asp:CommandField HeaderText="Function" ShowEditButton="True" />
        <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
            ReadOnly="True" SortExpression="Id" />
        <asp:BoundField DataField="Word" HeaderText="Word" SortExpression="Word" />
        <asp:BoundField DataField="Trans_AR" HeaderText="Trans_AR" 
            SortExpression="Trans_AR" />
        <asp:BoundField DataField="Trans_EN" HeaderText="Trans_EN" 
            SortExpression="Trans_EN" />
        <asp:BoundField DataField="Add_Date" HeaderText="Add_Date" 
            SortExpression="Add_Date" />
    </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="SDSTrans" runat="server" 
        ConnectionString="Data Source=ELARABY-1EACFA3\SQLEXPRESS;Initial Catalog=ElarabyGroup;Integrated Security=True" 
        ProviderName="System.Data.SqlClient" SelectCommand="GetAllTranslation" 
        SelectCommandType="StoredProcedure" UpdateCommand="UpdateTranslation" 
        UpdateCommandType="StoredProcedure">
        <UpdateParameters>
            <asp:ControlParameter ControlID="GridView1" Name="Id" 
                PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="GridView1" Name="Word" 
                PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="GridView1" Name="Trans_AR" 
                PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="GridView1" Name="Trans_EN" 
                PropertyName="SelectedValue" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
<asp:Label ID="ResultLBL" runat="server" Visible="false"></asp:Label>
</div>

CS

public void CheckLoginAuthorty()
{
    using (SqlConnection Con = Connection.GetConnection())
    {
        SqlCommand com = new SqlCommand("CheackLoginInRole", Con);
        com.CommandType = CommandType.StoredProcedure;
        com.Parameters.Add(Parameter.NewNVarChar("@Login", Session.Contents["Username"].ToString()));
        object O = com.ExecuteScalar();

        if (O != null)
        {
            string S = O.ToString();

            if (IsInRole("AR-Translator", O.ToString()))
            {

                ((BoundField)GridView1.Columns[2]).ReadOnly = false;
                ((BoundField)GridView1.Columns[2]).InsertVisible = false;
                ((BoundField)GridView1.Columns[4]).ReadOnly = false;
                ((BoundField)GridView1.Columns[4]).InsertVisible = false;


            }

            else if (IsInRole("EN-Translator", O.ToString()))
            {
                ((BoundField)GridView1.Columns[2]).ReadOnly = true;
                ((BoundField)GridView1.Columns[2]).InsertVisible = false;
                ((BoundField)GridView1.Columns[3]).ReadOnly = true;
                ((BoundField)GridView1.Columns[3]).InsertVisible = false;
            }
        }
    }
}
  • 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-16T04:05:11+00:00Added an answer on May 16, 2026 at 4:05 am

    I guess you need to update your “update” SP like this

    ALTER Proc [dbo].[UpdateTranslation]
    (
      @IdINT
      ,@Word NVARCHAR(MAX)
      ,@Trans_AR NVARCHAR(MAX)
      ,@Trans_EN NVARCHAR(MAX)
    
    
    )
    AS
    BEGIN 
      UPDATE  Translation SET
    
      Word =isnull(@Word,Word)
      ,Trans_AR=isnull(@Trans_AR, Trans_AR)
      ,Trans_EN=isnull(@Trans_EN ,Trans_EN)
    
      WHERE Id=@Id
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here i have gridview which contain some values retrieved from database.We put radiobutton list
I have a GridView in android which I fill it with data retrieved from
I have a gridview that is bound to an ObjectDataSource, which retrieves records from
I have a gridview which in one column is displaying MAC addresses. Instead of
I have a GridView which binds data from DB, and using rowboundevent, I want
I have a gridview which will have Insert/Delete/Update. There are two kinds of exception
I have a GridView which is programatically filled from the DB (not a SqlDataSource
I have a GridView which is databound to an XML Datasource. For one of
Have a gridview control which will show X amount of rows. I want to
For example, Lets say that I have a gridview column which has important controls,

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.