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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:25:14+00:00 2026-05-18T00:25:14+00:00

i have a strange problem. In RowCreated of the GridView i add following script

  • 0

i have a strange problem.
In RowCreated of the GridView i add following script to select a row:

Select Case e.Row.RowType
       Case DataControlRowType.DataRow
           e.Row.Attributes("onclick") = Me.Page.ClientScript.GetPostBackClientHyperlink(Me.MainGrid, "Select$" & e.Row.RowIndex)
End Select

This works like a charm(i thought).
But when i debug the SelectedIndexChanging and the following SelectedIndexChanged events, i observe that the RowState of the selected Row switches from normal{0}/alternate{1} to 3 instead of selected{2}.
This occurs between SelectedIndexChanging and SelectedIndexChanged.
Why does this happen?

The next time i programmatically set the selectedIndex(f.e. after a new row was created), i have two rows that are selected and no (un-hacky) way to deselect the old in RowDataBound, because of the invalid RowState of 3(should only be 0,1,2,4 or 8).

Thank you.

  • 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-18T00:25:15+00:00Added an answer on May 18, 2026 at 12:25 am

    I still don’t know why the RowState changes to 3, but i have a solution for the multiple selected rows. So far i set the GridView.SelectedIndex in RowDataBound:

      If LblPrimaryKey.Text.Equals(Me.CurrentID) Then
         Me.MainGrid.SelectedIndex = e.Row.RowIndex
      End If
    

    Now i only save the new selectedIndex in a variable and set it after this:

      If LblPrimaryKey.Text.Equals(Me.CurrentID) Then
         selectedIndex = e.Row.RowIndex 'member variable'
         'Me.MainGrid.SelectedIndex = e.Row.RowIndex'
      End If
    

    And after RowDataBound in the function that called DataBind:

      Me.MainGrid.DataBind()
      Me.MainGrid.SelectedIndex = Me.selectedIndex
    

    Now all old selections are cleared and only one row is selected.

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

Sidebar

Related Questions

I have a strange problem with select on chrome. I want to add a
I have strange problem on my pc/server. I run query such as Select field1,
I have a strange problem. I have a jQuery document.ready function executing some script
I have strange problem. For a project we are using following cloud hosting. http://www.rackspace.com
I have a strange problem with Jquery Ajax with the following code. Situation 1:
I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed
i have strange problem doing reporting: i have numerous clients with different issued invoices.
I have strange problem with receiving data from socket. On client im using air
Hello I have strange problem. I configured spring + hibernate. I`m using annotation configuration
I have a strange problem while trying to start JBoss from Eclipse. After starting,

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.