473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Timing of updating labels and GridView after a SQLDataSource read

I have a problem wherein a query that updates a GridView doesn't seem to
really stay in sync with a label I have above the GridView.

I have a GridView object that I'm updating with information whenever my
user enters a job number into a textbox and hits a button. There is a
SQLDataSource object on the page that does the retrieval of the data, and
the job number parameter for its query is bound to the textbox "Text"
value. In the button handler, I'm simply saying:

protected void btnFindJob_Click(object sender, System.EventArgs e)
{
if (txtJobNumber.Text == "")
{
Message.Text = "You must enter a job number first.";
ShowAsError(Message);
}
else
{
GridView1.DataSourceID = "DropsInJob"; // connecting the
DataSource object and the grid will retrieve the data and bind it
ShowAsText(Message);
if (GridView1.Rows.Count > 0)
{
Message.Text = "Found the following drops for job " +
txtJobNumber.Text +
". Drops are sorted by file creation date/time:";
}
else
{
Message.Text = "Could not find any drops for job " +
txtJobNumber.Text + ".";
ShowAsError(Message);
}
}
}
"Message" is my label. What happens is that the grid updates as it's
supposed to, but the label seems to lag a little. Let's say I run a query
on job #123 that has no entries. The grid will not show up and the label
will show "There are no drops for job 123". Then I type in a different job
number, 678, into the textbox and hit the button. The grid updates with
the retrieved data on that job, but the label still says "There are no
drops for job 678". The grid is right and the job number in the label is
right, but the text of the label is wrong. If I hit the button again right
away, the label changes to "Found these drops for job 678:", as it's
supposed to.

I'm thinking I should be updating the label text in a different place or
something; a different method, maybe during rendering? Anybody see what
I'm doing wrong, here? I'd sure appreciate some feedback.

Thanks,
Michael
Apr 6 '06 #1
0 1356

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: P | last post by:
Hello, I am having a difficult time updating a record via a stored procedure using the gridview and sqldatasource. I cannot seem to be able to find a way to set everything up so that I can pass...
3
by: adam222 | last post by:
hello, i have a web-form with a GridView control, i wanted to update & delete, using the AutoGenerateEditButton. when i used it with sqlDataSource (executing SP in the DB) it works like a...
1
by: Avanti | last post by:
Hello, I have a gridview wherein I've added functionality for Edit. Now, when I click on the Edit button, and modify a field, and click on the Update button, the new values disappear and the old...
6
by: Dabbler | last post by:
I have a GridView with a couple of TemplateFields. When I click the update link the Gridview returns to display mode with no errors but the data from bound text fields or dropdown list isn't...
0
by: ASMJ | last post by:
Hi, I have a web page where I use a sqldatasource to manipulate data in a gridview. I am using all the sqlstatements generated by the sqldatasource and I have not hand written any code. The...
4
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I setup a simple gridview as a utility just to do some updates, nothing fancy just wanted easy UI to make updates. When I select ‘Edit’, I get the fields I want to edit. I edit them and click...
0
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ...
0
by: TheDebbis | last post by:
I'm making a quick CD catalog to help me learn ASP.NET (using C# primarily.) I have a number of gridview's on my site that are working properly, but for some reason, one is not updating or deleting....
2
by: xMetalDetectorx | last post by:
Hi Everyone, I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.