469,903 Members | 2,013 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

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 11537
Simon,

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

Eliyahu

"Simon Strandgaard" <ne*****@gmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.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.DataBind(); 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 enableEventValidation="true"/> in configuration or <%@
Page EnableEventValidation="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
ClientScriptManager.RegisterForEventValidation 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_PreRenderComplete().
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by coynej60 | last post: by
2 posts views Thread by Flinky Wisty Pomm | last post: by
3 posts views Thread by Guru | last post: by
4 posts views Thread by Mark Olbert | last post: by
1 post views Thread by =?Utf-8?B?V2VzbGV5IERhdmlzLCBHZW5lcmFsIER5bmFtaWNz | last post: by
4 posts views Thread by Craig Buchanan | last post: by
3 posts views Thread by =?Utf-8?B?cm9kY2hhcg==?= | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.