Click twice for dataload into listbox

I have a gridview which when I click the gridview edit button it loads some values into a listbox.

My problem is that I have to click the edit button twice for this to happen. Is there a reason for this.

I am using c# and asp.net
Mr_ShawAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Obadiah ChristopherCommented:
Make sure u have checked for the IsPostBack Condition in page load where you might have written code to bind the grid.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mr_ShawAuthor Commented:
I am not sure what you mean

page_load and the code benhind the grid and two seperate sections
0
Obadiah ChristopherCommented:
Where have u written code to bind the grid? in  Page load
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Mr_ShawAuthor Commented:
I have tried running my code both inside  and outside of

if (Page.IsPostBack)
        {
}
0
Mr_ShawAuthor Commented:
Everything seems to be acting on the previous click.

for example to value selected in the 1st click was one
the value selected in the 2nd click was two.

When I click for the second time the 1st clicks values is processed. ahhhhhhhh
0
srikanthreddyn143Commented:
Move the focus out of gridview in click event
0
Mr_ShawAuthor Commented:
what do you mean by move the focus.... do you think you could give me an example?
0
srikanthreddyn143Commented:
When Edit button is clicked, Make the focus move to any other control like txtboxx1.focus()
0
Mr_ShawAuthor Commented:
I'm really sorry to have to say this... but changing the focus does not help.

My code is always one click behind what I am actually doing,

Everything seems to be acting on the previous click.

for example to value selected in the 1st click was one
the value selected in the 2nd click was two.

When I click for the second time the 1st clicks values is processed. ahhhhhhhh
0
Mr_ShawAuthor Commented:
thanks for the help....

It ended up being the way I ordered my code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.