473,657 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refreshing / requerying GridView control when page is submitted?

Hi All,

I have an ASP.NET page that is used to insert records into an SQL
Server table (see previous post). I also have a GridView on the same
page that displays the results of a query on the same table the records
are inserted into when the page is submitted.

I'm wondering if there's a way to requery / refresh the records being
displayed by the GridView when the page is submitted?

Currently when I submit the page, which inserts a record, the GridView
doesn't refresh / requery to display the newly inserted record.

Can anyone point me at what I should be doing in the page submit code
to make sure the GridView also displays the record just inserted?

Many thanks in advance!

Much warmth,

planetthoughtfu l
---
"Lost in thought"
http://www.planetthoughtful.org

May 26 '06 #1
1 4692
If you are inserting through your datasource, it should only be a matter of
rebinding to your datasource .. if not just redread your datasource and then
rebind it.

Cheers,

Greg Young
MVP - C#
"planetthoughtf ul" <pl************ **@gmail.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
Hi All,

I have an ASP.NET page that is used to insert records into an SQL
Server table (see previous post). I also have a GridView on the same
page that displays the results of a query on the same table the records
are inserted into when the page is submitted.

I'm wondering if there's a way to requery / refresh the records being
displayed by the GridView when the page is submitted?

Currently when I submit the page, which inserts a record, the GridView
doesn't refresh / requery to display the newly inserted record.

Can anyone point me at what I should be doing in the page submit code
to make sure the GridView also displays the record just inserted?

Many thanks in advance!

Much warmth,

planetthoughtfu l
---
"Lost in thought"
http://www.planetthoughtful.org

May 26 '06 #2

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

Similar topics

5
4831
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
0
2283
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web Setup Project and installed My Web Application on my Localhost and it works perfectly. When I install My Web Application on our “Production Server” it just doesn’t update the records on Edit mode!!!
0
1840
by: H5N1 | last post by:
Hi there My problem is that in when I update GridView row, which is nested into DataList control, I want to refresh also DataList in which the GridView is nested, since after update, trigger in my DB changes some value in it (some Total sum from the GridView column). The GridView, along with its ObjectDataSource is inserted into DataList ItemTemplate.
1
1608
by: Mike Grace | last post by:
Hi, I have a gridview which is using a SqlDataSource to update a table. The SqlDatasource is using a stored procedure to update the table. If I edit a row, change a value and click update the change is successfully applied to the SQL table. After this, the values in the underlying table could be changed by another
0
1515
by: steve.craver | last post by:
I am working with a multi-field search form which, when the form is submitted, queries a database and returns the results into a paginated GridView object. The site is being developed with master pages. So far, I have had success in building the search form, and passing the values entered by the user from the form to a results page, and displaying the entire resultset using GridView. However, when I set the AllowPaging option on the...
1
5211
by: joechipubik | last post by:
I have a GridView in a FormView that has as its datasource a DataTable that is stored in the session cache. When I first load the page the GridView is displayed correctly, but on subsequent loads the GridView does not display. I've debugged the DataTable and even when it has data and is bound to the GridView, when the page loads the GridView is not displayed. I set the datasource and then bind the GridView. I've tried disabling the...
9
1865
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg", and an option for the user to update the photo. If they click the update button, I then flip up a new panel, where I have a FileUpload control and corresponding Upload Button. If they load an image file and click the Upload button, my code uses...
3
9241
by: Asaf | last post by:
Hi, I have SqlDataSource control that makes a "select count" to show how many rows there are in a Table and it is working fine on first page load. The problem is that when I am inserting a new row to the database table at the same ASPX page the rows count from the SqlDataSource remain the same. To refresh the SqlDataSource I have used his Select(DataSourceSelectArguments.Empty) but no luck.
8
7730
by: gerry | last post by:
The PagerSettings.Visible property is not being handled properly by the GridView control. The value assigned to this property is not applied until after a postback. Simplest test : .aspx containing a single gridview - enable paging and give enough data to page. add checkbox with auto postback enable add button with auto postback enable in the GridView1_PreRender method add the following : GridView1.HeaderRow.Enabled =
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8326
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8845
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8743
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.