Solved

Click twice for dataload into listbox

Posted on 2009-05-20
10
242 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:Mr_Shaw
  • 6
  • 2
  • 2
10 Comments
 
LVL 20

Accepted Solution

by:
informaniac earned 250 total points
ID: 24432625
Make sure u have checked for the IsPostBack Condition in page load where you might have written code to bind the grid.
0
 

Author Comment

by:Mr_Shaw
ID: 24432667
I am not sure what you mean

page_load and the code benhind the grid and two seperate sections
0
 
LVL 20

Expert Comment

by:informaniac
ID: 24432874
Where have u written code to bind the grid? in  Page load
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

Author Comment

by:Mr_Shaw
ID: 24433044
I have tried running my code both inside  and outside of

if (Page.IsPostBack)
        {
}
0
 

Author Comment

by:Mr_Shaw
ID: 24433255
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
 
LVL 11

Assisted Solution

by:srikanthreddyn143
srikanthreddyn143 earned 250 total points
ID: 24433269
Move the focus out of gridview in click event
0
 

Author Comment

by:Mr_Shaw
ID: 24433307
what do you mean by move the focus.... do you think you could give me an example?
0
 
LVL 11

Expert Comment

by:srikanthreddyn143
ID: 24433448
When Edit button is clicked, Make the focus move to any other control like txtboxx1.focus()
0
 

Author Comment

by:Mr_Shaw
ID: 24433478
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
 

Author Closing Comment

by:Mr_Shaw
ID: 31583546
thanks for the help....

It ended up being the way I ordered my code.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question