473,621 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

refresh gridview at postback

Hi group,
my setup:
I have a GridView that extracts data from my table (a SqlDataSource).
For each row, I have an 'edit' button and a 'delete' button.
The 'edit' button opens a popup, through which one can insert and edit
the table.
The 'delete' button deletes the row.
my problem:
The 'delete' button does NOT work, if I at postback invoke databind on
the gridview.
The 'delete' button works, if I at postback does NOT invoke databind on
the gridview.
my questions regarding Page_Load:
A) how can I determine if 'edit' has 'touched' the table ?
B) how can I determine if one has clicked the 'delete' button' ?

--
Simon Strandgaard - http://neoneye.dk/

Apr 20 '06 #1
3 11753
Simon,

Are you sure your "delete" action reaches the source of your data?

Eliyahu

"Simon Strandgaard" <ne*****@gmail. com> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
Hi group,
my setup:
I have a GridView that extracts data from my table (a SqlDataSource).
For each row, I have an 'edit' button and a 'delete' button.
The 'edit' button opens a popup, through which one can insert and edit
the table.
The 'delete' button deletes the row.
my problem:
The 'delete' button does NOT work, if I at postback invoke databind on
the gridview.
The 'delete' button works, if I at postback does NOT invoke databind on
the gridview.
my questions regarding Page_Load:
A) how can I determine if 'edit' has 'touched' the table ?
B) how can I determine if one has clicked the 'delete' button' ?

--
Simon Strandgaard - http://neoneye.dk/

Apr 20 '06 #2
Hi Eliyahu,

I am seeking a solution where 'delete' and 'edit' will work.
X) without invoking databind, then 'delete' correctly removes
the row. However then 'edit' fails to refresh the gridview.

Y) when invoking databind, then 'edit' correctly refreshes
the gridview. However 'delete' results in an error
(see bottom of this mail).
I should have told in my original post;
that I invoke mygridview.Data Bind(); in order to force a
refresh of the gridview. I am not sure if there is a smarter
way to force a refresh?
From the 'edit' popup one can modify my table and thus

I want to refresh the parent window so the gridview reflects
the current table data.


Summary of what I am trying to accomplish:
* The gridview extracts data from my table.

* Via the 'edit' popup, users can modify my table.

* When a user has edited my table, then the gridview
should be refreshed.

* When a user clicks 'delete' on a row in the gridview,
then it should be removed.


below is the error message for (Y):
Invalid postback or callback argument. Event validation is enabled
using <pages enableEventVali dation="true"/> in configuration or <%@
Page EnableEventVali dation="true" %> in a page. For security purposes,
this feature verifies that arguments to postback or callback events
originate from the server control that originally rendered them. If
the data is valid and expected, use the
ClientScriptMan ager.RegisterFo rEventValidatio n method in order to
register the postback or callback data for validation.

--
Simon Strandgaard - http://neoneye.dk/

Apr 20 '06 #3
Simon Strandgaard skrev:
I am seeking a solution where 'delete' and 'edit' will work.

[snip]

I have solved it, by moving databind from Page_Load()
into Page_PreRenderC omplete().
Now both 'edit' and 'delete' works.

Still not sure if this is the smartest solution?
--
Simon Strandgaard - http://neoneye.dk/

Apr 21 '06 #4

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

Similar topics

1
3105
by: coynej60 | last post by:
I have a GridView that is bound to a SqlDataSource that uses Stored Procedures for its Select, Insert, Update and Delete Commands. The Gridview only contains one visible column (PK Identity column is hidden). There is a textbox and button that I use to submit a new row. Everything works fine, however when I submit a new row it does not show up in the Gridview after I rebind the data. In the Page_Load event (outside of my check for a...
2
2752
by: Flinky Wisty Pomm | last post by:
Hi all, I've got a really annoying problem that I need to fix sharpish. I've got a GridView derived control which has a templated header and footer. It works wonderfully on the first render but then the header/footer vanish into thin air. If I add the header/footer onDataBound then they disappear when I do a postback with no databinding. If I add them during PreRender, then they persist, but one of my data rows is emptied for each time I...
3
7206
by: Guru | last post by:
How do I refresh GridView using CallBack? I am populating the grid at runtime using OLEDB.
12
3799
by: Cindy Lee | last post by:
When I do a sorta on 1 table, then the other table goes back to the original order. What can I set so, it keeps the order of the other current gridview's order. I set all the gridview values in my 'onpageload' in the cs file.
4
2531
by: Mark Olbert | last post by:
I'm running into a well-described issue in the ASPNET model that I haven't found a good work around for. I have a GridView to which I dynamically add data-bound TemplateFields at run-time. The specific fields that are added depend on the state of the application. The contents of these fields displays properly after they are first initialized, but not after postback (e.g., just a simple button control that doesn't do anything except...
1
11227
by: =?Utf-8?B?V2VzbGV5IERhdmlzLCBHZW5lcmFsIER5bmFtaWNz | last post by:
I'm moving from years with the datagrid to a new project, .net 2.0, using GridView controls. Per past practice, it is often a lot easier to inject controls (or special formatting) in RowDataBound (formerly ItemDataBound) than to mess with complicated templates, especially for things that are consistent across grids or columns. GridView is dumping all the nice stuff put there during a RowDataBound event. Ex: those "!" icons in outlook or...
3
3888
by: Dave | last post by:
I have an GridView on one page that will open a popup for the selected record. I've been told that there is a way that when the popup record is updated the GridView can be refreshed or Databind. I've been looking for the answer with no luck. I'm probably just not asking the question correctly. Thanks for any assistance.
4
10999
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like to iterate thru the gridview's rows, examine the databound controls, then perform a database action. for some reason, i can't find the controls. i have a two templates: one that uses a label the other uses a textbox to display data. when the...
3
1807
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hi all, i betcha here's a question never asked before ;) i have a simple web form with a gridview and a button. the button doesn't do anything but a postback. i load up the gridview from the database, hit the button, then hit the refresh button and here's where my question occurs. I get a message saying that "it needs to resubmit/resend the data?" what is happening here and how do I resolve this undesired message?
0
8156
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
8597
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...
0
7127
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6101
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
5554
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();...
0
4065
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2587
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1460
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.