[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Click twice for dataload into listbox

Posted on 2009-05-20
10
Medium Priority
?
268 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 1000 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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 1000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

830 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