473,569 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Clic k(object sender, System.EventArg s e)
{
if (txtJobNumber.T ext == "")
{
Message.Text = "You must enter a job number first.";
ShowAsError(Mes sage);
}
else
{
GridView1.DataS ourceID = "DropsInJob "; // connecting the
DataSource object and the grid will retrieve the data and bind it
ShowAsText(Mess age);
if (GridView1.Rows .Count > 0)
{
Message.Text = "Found the following drops for job " +
txtJobNumber.Te xt +
". Drops are sorted by file creation date/time:";
}
else
{
Message.Text = "Could not find any drops for job " +
txtJobNumber.Te xt + ".";
ShowAsError(Mes sage);
}
}
}
"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 1368

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

Similar topics

1
2002
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 the applicable fields in the gridview to a sqldatasource which in turn calls a sproc with the appropriate parameters and data. Any ideas? Thanks...
3
2221
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 charm, but when i want to pass the data through the application's layers (BL etc.), it did not work. it seems that the 'AutoGenerateEditButton' is...
1
1791
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 values are retained. Here is my source code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
6
2387
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 updated in the table. I'm stumped and any help would be appreciated. Thanks much. My GridView: <asp:GridView ID="VanListGridView" runat="server"
0
1501
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 problem is that the Gridview does not update any rows having null values. This is because the option of "Use Optimistic Concurrency" is checked while...
4
8739
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 ‘Update’, the page returns to its original state (prior to clicking Edit) and no updates occur in the DB. What am I missing? I included the...
0
2213
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 ParkingBay CommandField Me Y dropdownlistvalue CommandField You ...
0
1542
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. I have the buttons for both visible, and when I click edit, the update fields show up properly, but once I click 'update' the table is back with it's...
2
1780
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 SQLDataSource and a GridView control. I am using the GridView to test updating a very simple table in the database. The problem is, it will not Update the...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.