473,386 Members | 1,598 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,386 software developers and data experts.

Postback, DataBinding, Refresh

Hi -

I've got a couple of pages where a DataList is populated only if(!Postback).
I have buttons in the datagrid that allow for the 'deletion' of items from
that DataList.

The problem is that the deleted items don't disappear on Postback, but only
after a page refresh. I assume this is because the DataList is not
redatabound unless !Postback. However, if I remove the if(!Postback)
statement, the button's 'delete' method doesn't seem to work at all.

How can I fix this? Do I need to disable viewstate on some things, or do
something like move my PopulateDataList() method from Page_Load to
Pre_Render? Thus far I've been forcing a page refresh after the 'delete'
method is run, by doing Response.Redirect(Request.RawUrl), and that works,
but it doesn't seem efficient.

Thanks in advance!

-John
Nov 18 '05 #1
4 2418
"John" <jc*****************@hotmail.com> wrote in message
news:fG****************@news-server.bigpond.net.au...
Hi -

I've got a couple of pages where a DataList is populated only if(!Postback). I have buttons in the datagrid that allow for the 'deletion' of items from
that DataList.

The problem is that the deleted items don't disappear on Postback, but only after a page refresh. I assume this is because the DataList is not
redatabound unless !Postback. However, if I remove the if(!Postback)
statement, the button's 'delete' method doesn't seem to work at all.

How can I fix this? Do I need to disable viewstate on some things, or do
something like move my PopulateDataList() method from Page_Load to
Pre_Render? Thus far I've been forcing a page refresh after the 'delete'
method is run, by doing Response.Redirect(Request.RawUrl), and that works,
but it doesn't seem efficient.


John, you'll need to refresh the data in the grid the same way you did in
"if(!PostBack)".
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
Thanks for the reply!

Just to make sure I understand what you mean - I need to databind again
within the button's 'delete' method after it's made its change to the
database?

Thanks again!

-John

John, you'll need to refresh the data in the grid the same way you did in
"if(!PostBack)".
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #3
"John" <jc*****************@hotmail.com> wrote in message
news:Hs****************@news-server.bigpond.net.au...
Thanks for the reply!

Just to make sure I understand what you mean - I need to databind again
within the button's 'delete' method after it's made its change to the
database?

Yes, that's correct. You might want to do the same thing on inserts or
updates, except that you might be able to short-circuit the process if you
found it worthwhile.

Are you handline paging and sorting yet? Those are another case when a
DataBind is useful.
--
John Saunders
johnwsaundersiii at hotmail

John, you'll need to refresh the data in the grid the same way you did in "if(!PostBack)".
--
John Saunders
johnwsaundersiii at hotmail


Nov 18 '05 #4
Excellent - thank you very much for your help.

I haven't had to do much with paging or sorting, yet, but will in the near
future (getting stuck into an assignment where they seem to expect us to
learn everything in one go) - that insight will doubtless save me some
head-scratching. Seemed like it would be a common problem for one who has no
idea what they're doing... I guess I just couldn't get my google-searches
right; so I'm glad I'm sorted now.

Thanks again!

-John

"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yes, that's correct. You might want to do the same thing on inserts or
updates, except that you might be able to short-circuit the process if you
found it worthwhile.

Are you handline paging and sorting yet? Those are another case when a
DataBind is useful.
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #5

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

Similar topics

1
by: davidw | last post by:
This troubles me for a while. When user click back button and click submit button, I get the same data as user click refresh(it resubmit the page too). Is there a way to tell the difference? ...
0
by: Sam Martin | last post by:
Hi all, I've got some properties in a business component that get bound to controls on a form using ctrl.DataBindings.Add(.....) The properties are, as you'd expect, updated when their bound...
1
by: francois | last post by:
I have a ASPX form with a dropdownlist that makes a post back (to the same page of course, just a normal asp.net postback) That page also has an auto refresh javascript as it needs to refresh its...
1
by: francois | last post by:
I have a ASPX form with a dropdownlist that makes a post back (to the same page of course, just a normal asp.net postback) That page also has an auto refresh javascript as it needs to refresh its...
9
by: ruca | last post by:
Can I force my page to do postback? I have a page that only have links, but I wish that every time I click a link that execute a function that I have in my code. I know that with simple links,...
5
by: Vincent A. | last post by:
Hello, I'm developping an asp.net application which used master page on which i add several web control. One of the them is a menu control which as several button in order to develop each sub...
1
by: Jason | last post by:
I have a webpage that I've wrapped in an Atlas UpdatePanel. This page contains four textboxes, each with AutoPostBack set to true. The problem comes when someone edits the first box and tabs to...
1
by: Charles Bazi | last post by:
Hi, Based on MSDN http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx smple, I have made my custom DataGridViewColumn. I use it to host a custom control, sort of ComboBox, but instead of...
1
by: alectang | last post by:
I have an application that works fine on localhost but when deploying to a new server, all postback events don't work anymore. ie. a button clicked but the page just refreshes, instead of doing...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.