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

The Archive Base Latest Questions

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

In ASP.NET 4.0 GridView, is it possible to have multiple rows in edit mode

  • 0

In ASP.NET 4.0 GridView, is it possible to have multiple rows in edit mode at the same time?

I’m controlling the rows with edit mode in a property:

Private Property Editing As List(Of Integer)
   Get
       If ViewState("Editing") Is Nothing Then ViewState("Editing") = New List(Of Integer)
       Return CType(ViewState("Editing"), List(Of Integer))
   End Get
   Set(value As List(Of Integer))
       ViewState("Editing") = value
   End Set
End Property

Populating it when the user clicks on edit button:

Protected Sub GridView1_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
    If e.CommandName = "Edit" Then
        Dim row = CType(CType(e.CommandSource, LinkButton).NamingContainer, GridViewRow)
        Editing.Add(row.RowIndex)
    End If
End Sub

And changing the RowState property manually in the RowDataBound event:

Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
    If e.Row.RowType = DataControlRowType.DataRow Then
        If Editing.Contains(e.Row.RowIndex) Then
            Then e.Row.RowState = DataControlRowState.Edit
        End If
    End If
End Sub

But it’s not working, the rows is being rendered in the normal state… any ideias?


EDIT 2: PROPERTY

MultipleEditGridView.vb:

Namespace ClubeCheckIn.UI

        Public Class MultipleEditGridView
            Inherits GridView

            Protected Property IsRowInEditMode(rowIndex As Int32) As Boolean
                Get
                    If ViewState("GridRowEditIndices") Is Nothing Then
                        Return False
                    Else
                        Dim indices = DirectCast(ViewState("GridRowEditIndices"), List(Of Int32))
                        Return indices.Contains(rowIndex)
                    End If
                End Get
                Set(value As Boolean)
                    If ViewState("GridRowEditIndices") Is Nothing Then
                        ViewState("GridRowEditIndices") = New List(Of Int32)
                    End If
                    Dim indices = DirectCast(ViewState("GridRowEditIndices"), List(Of Int32))
                    indices.Remove(rowIndex)
                    indices.Add(rowIndex)
                End Set
            End Property

        End Class

    End Namespace

web.config:

<controls>
    <add tagPrefix="clube" namespace="ClubeCheckIn.UI" />
</controls>

ASPX:

<clube:MultipleEditGridView ID="GridView1" runat="server">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:TextBox ID="txtEdit" runat="server" Visible="<%# IsRowInEditMode(Container.DataItemIndex) %>" />
            </ItemTemplate>
    </Columns>
</clube:MultipleEditGridView>

ERROR:

Error: BC30451: ‘IsRowInEditMode’ is not declared. It can be inacessible due to the protection level

  • 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-16T11:51:51+00:00Added an answer on June 16, 2026 at 11:51 am

    I’m pretty sure that the GridView does not support multiple rows in edit-mode.

    As a work around you can use the ItemTemplate for both states (f.e. a Label and a TextBox). Then you can use a property EditMode with RowIndex as argument. You can store the rows in edit-mode in ViewState.

    (not tested)

    Protected Property IsRowInEditMode(rowIndex As Int32) As Boolean
        Get
            If ViewState("GridRowEditIndices") Is Nothing Then
                Return False
            Else
                Dim indices = DirectCast(ViewState("GridRowEditIndices"), List(Of Int32))
                Return indices.Contains(rowIndex)
            End If
        End Get
        Set(value As Boolean)
            If ViewState("GridRowEditIndices") Is Nothing Then
                ViewState("GridRowEditIndices") = New List(Of Int32)
            End If
            Dim indices = DirectCast(ViewState("GridRowEditIndices"), List(Of Int32))
            indices.Remove(rowIndex)
            indices.Add(rowIndex)
        End Set
    End Property
    

    you could call it directly from the markup, f.e. for the edit-controls:

    Visible='<%# IsRowInEditMode(Container.DataItemIndex) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an asp.net gridview inside an updatepanel. One of the fields I have
I have an ASP.NET GridView with paging enabled. The list of page indexes are
I have a traditional ASP.NET GridView. Inside of it I have a Template Field
I have a Jquery Accordion and I have a asp.net GridView below that. When
I have problems binding both a telerik RadGrid and a plain vanilla ASP.NET GridView
I have an ASP.NET gridview I want to manipulate using JavaScript/JQuery. The problem I
I have a Checkbox template column in a ASP.NET 3.5 GridView. Now the user
I have a GridView and want to on an ASP.NET Web Application page and
in asp.net, when you have an autogenreated select button on a gridview, is it
in ASP.Net Gridview properties inside PagerSettings, how can we add new mode named NumericNextPreviousFirstLast

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.