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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:54:51+00:00 2026-06-16T01:54:51+00:00

Data source of my grid view comes of stored procedure by using linqdatasource. The

  • 0

Data source of my grid view comes of stored procedure by using linqdatasource. The parameter of this linqdatasource is the textbox (txtSearchKeywords) ,when I press the search button the gridview takes the data according to below code.
Now I like to update or delete some rows of gridview, so I have added command field (edit/delete) to gridview and enabled edit/delete linqdatasource but I cannot update the row, actually I cannot even type in the row. Nothing is active , just shows edit/update/cancel buttons.
Please help how I can solve?

Stored procedure:

ALTER PROCEDURE [dbo].[spQuickSearchDoc]
  @Searchtext varchar(50)=null
AS
 select DocId,DocumentNo,Title,Unit
 from tblDocuments
 where DocumentNo like '%'+@SearchText + '%'
  or Title like '%'+@SearchText + '%'
  or Unit like '%'+@SearchText + '%'

linqdatasource:

 <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
          ContextTypeName="EDMSDataContext" OnSelecting="LinqDataSource2_Selecting" 
          EnableDelete="True" EnableUpdate="True" TableName="tblDocuments" EnableInsert="True"  
           >
          <WhereParameters>
    <asp:ControlParameter Name="Subject"
                          ControlID="txtSearchKeywords"
                          PropertyName="Text"
                          Type="String" />
</WhereParameters>
      </asp:LinqDataSource>

Gridview:

<asp:GridView ID="GridViewDocuments_Search" runat="server" AutoGenerateColumns=False 
          Visible="False" onrowcommand="GridViewDocuments_Search_RowCommand" DataKeyNames="DocId" 
          PageSize="100" DataSourceID="LinqDataSource2"  >
    <Columns>
        <asp:BoundField DataField="DocumentNo" HeaderText="DocumentNo" 
            SortExpression="DocumentNo" ReadOnly="True" />

        <asp:BoundField DataField="TITLE" HeaderText="TITLE" ReadOnly="True" 
            SortExpression="TITLE" />

       <asp:BoundField DataField="Unit" HeaderText="Unit" SortExpression="Unit" 
            ReadOnly="True" />
        <asp:BoundField DataField="DocId" HeaderText="DocId" ReadOnly="True" 
            SortExpression="DocId" />
        <asp:CommandField ShowEditButton="True" />
        <asp:CommandField ShowDeleteButton="True" />
    </Columns>
</asp:GridView>

Code:

public void LinqDataSource2_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
_DataContext = new EDMSDataContext();

 var subjectFilter = e.WhereParameters["Subject"];


 var query = _DataContext.spQuickSearchDoc(subjectFilter.ToString());


e.Result = query;
}


  protected void btnSearch_Click(object sender, EventArgs e)
{
    _DataContext = new EDMSDataContext();
    this.LinqDataSource2.WhereParameters["Subject"].DefaultValue = this.txtSearchKeywords.Text;

    GridViewDocuments.Visible = false;
    GridViewDocuments_Search.Visible = true;
    this.GridViewDocuments_Search.DataBind();

}
  • 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-06-16T01:54:52+00:00Added an answer on June 16, 2026 at 1:54 am

    Do you get an error when you click on the Edit link in the grid view row?

    You can handle the following three events in order to enable the data in your grid to be updated:

    1) RowEditing

    2) RowUpdating

    3) RowCancellingEdit

    A simple google search with the event name + linq datasource in grdiview will bring up more than enough examples on how

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

Sidebar

Related Questions

Im using a List<Patient> object as the data source to a data grid view.
I had grid view which bind sql data source and added field to update
I have a grid view utilizing sql data source. Now I want to delete
I am currently doing data binding with a grid view with a data source
I have a fairly simple asp grid view, tied to an object data source.
i have this line of code in my view using the Telerik Grid: columns.Bound(o
i am trying to get checkbox value ,using c# In grid view the datasource
I don't see a LINQ option when picking a data source for a grid
I am using vb.net 2010. I have a datagridview whose data source is a
I have a SQLite database that is displayed in a data grid view in

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.