By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

asp:repeater not doing a refresh/postback

P: n/a
I am having a strange problem. The program is a bit complex, but I'll try to
simplify what I can. I apologize if this is complicated, but I think this
would still be simpler than posting a bunch of source code. If you want me
to post code, though, just say so.
In a nutshell, I've got an ASP.NET application that has one main ASPX page.
On that ASPX page, it has a user control (an ASCX) that displays the actual
data and controls I need.
On that user control, I have a drop-down list, and an asp:repeater tag that
contains an asp:label tag that contains:
<%# DataBinder.Eval(Container.DataItem, "DESC") %> as the Text= field

That asp:repeater also contains an asp:imagebutton that is a "Delete"
button.
Basically, when the user makes a selection from the drop-down list, a stored
procedure is called, and that data populates the asp:repeater (adding an
entry for each row retrieved by the stored procedure).
This part works fine.

The way it's set up, if the user clicks the "Delete" button after this has
been populated, it removes that entry from the database (which works
correctly), and then calls the code again to repopulate the repeater.
I've confirmed that this seems to work (the row does get deleted, and when
the stored procedure is called, it returns the proper rows, without the
"deleted" entry). But it does not appear to be refreshing the repeater. The
repeater (in some cases) remains with the additional row still showing, and
in other cases, blanks out entirely.
The code I use to populate is a function that calls the stored procedure,
and returns it in a DataTable. Then that DataTable is set up as the
DataSource of the repeater, and then does a .DataBind on it as well.
What am I missing? It seems to me that I need to force a refresh or postback
or something. But I'm at a loss to figure out how to do that.
Can anyone help?
Thanks!
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Scott,

When the user clicks on the Delete button, the page will post back and call
the sp to delete the record. Apparently this part worked as you described.
However, after deleting the record, you need create the DataTable again and
bind it to the grid. That will force the repeater to refresh.

L.L.
"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:OV**************@tk2msftngp13.phx.gbl...
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this
would still be simpler than posting a bunch of source code. If you want me
to post code, though, just say so.
In a nutshell, I've got an ASP.NET application that has one main ASPX page. On that ASPX page, it has a user control (an ASCX) that displays the actual data and controls I need.
On that user control, I have a drop-down list, and an asp:repeater tag that contains an asp:label tag that contains:
<%# DataBinder.Eval(Container.DataItem, "DESC") %> as the Text= field

That asp:repeater also contains an asp:imagebutton that is a "Delete"
button.
Basically, when the user makes a selection from the drop-down list, a stored procedure is called, and that data populates the asp:repeater (adding an
entry for each row retrieved by the stored procedure).
This part works fine.

The way it's set up, if the user clicks the "Delete" button after this has
been populated, it removes that entry from the database (which works
correctly), and then calls the code again to repopulate the repeater.
I've confirmed that this seems to work (the row does get deleted, and when
the stored procedure is called, it returns the proper rows, without the
"deleted" entry). But it does not appear to be refreshing the repeater. The repeater (in some cases) remains with the additional row still showing, and in other cases, blanks out entirely.
The code I use to populate is a function that calls the stored procedure,
and returns it in a DataTable. Then that DataTable is set up as the
DataSource of the repeater, and then does a .DataBind on it as well.
What am I missing? It seems to me that I need to force a refresh or postback or something. But I'm at a loss to figure out how to do that.
Can anyone help?
Thanks!

Nov 17 '05 #2

P: n/a
That's exactly what I'm doing.
In the module that does the delete, first it does the database call to
delete the row. Then it does the database call to re-populate the repeater
grid (and put that into the DataTable). Then it sets that DataTable to the
source of the grid, and then binds the data.

In fact, I've even stepped it through the code, and I saw it step right
through each step as expected.
But oddly enough, it still never refreshed the grid on the form.
Thanks!
-Scott

"L. L." <ll**@cyence.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
Scott,

When the user clicks on the Delete button, the page will post back and call the sp to delete the record. Apparently this part worked as you described.
However, after deleting the record, you need create the DataTable again and bind it to the grid. That will force the repeater to refresh.

L.L.
"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:OV**************@tk2msftngp13.phx.gbl...
I am having a strange problem. The program is a bit complex, but I'll try
to
simplify what I can. I apologize if this is complicated, but I think

this would still be simpler than posting a bunch of source code. If you want me to post code, though, just say so.
In a nutshell, I've got an ASP.NET application that has one main ASPX

page.
On that ASPX page, it has a user control (an ASCX) that displays the

actual
data and controls I need.
On that user control, I have a drop-down list, and an asp:repeater tag

that
contains an asp:label tag that contains:
<%# DataBinder.Eval(Container.DataItem, "DESC") %> as the Text= field

That asp:repeater also contains an asp:imagebutton that is a "Delete"
button.
Basically, when the user makes a selection from the drop-down list, a

stored
procedure is called, and that data populates the asp:repeater (adding an
entry for each row retrieved by the stored procedure).
This part works fine.

The way it's set up, if the user clicks the "Delete" button after this has been populated, it removes that entry from the database (which works
correctly), and then calls the code again to repopulate the repeater.
I've confirmed that this seems to work (the row does get deleted, and when the stored procedure is called, it returns the proper rows, without the
"deleted" entry). But it does not appear to be refreshing the repeater.

The
repeater (in some cases) remains with the additional row still showing,

and
in other cases, blanks out entirely.
The code I use to populate is a function that calls the stored procedure, and returns it in a DataTable. Then that DataTable is set up as the
DataSource of the repeater, and then does a .DataBind on it as well.
What am I missing? It seems to me that I need to force a refresh or

postback
or something. But I'm at a loss to figure out how to do that.
Can anyone help?
Thanks!


Nov 17 '05 #3

P: n/a
What about try the following,
After the row is deleted, close the browser. Double check to make sure the
row is actually deleted in the db. And then open the browser again to view
the page. If the row deleted is still in the data grid, the only thing I can
think of is caching. Maybe the page or user control is being cached.

L.L.

"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
That's exactly what I'm doing.
In the module that does the delete, first it does the database call to
delete the row. Then it does the database call to re-populate the repeater
grid (and put that into the DataTable). Then it sets that DataTable to the
source of the grid, and then binds the data.

In fact, I've even stepped it through the code, and I saw it step right
through each step as expected.
But oddly enough, it still never refreshed the grid on the form.
Thanks!
-Scott

"L. L." <ll**@cyence.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
Scott,

When the user clicks on the Delete button, the page will post back and call
the sp to delete the record. Apparently this part worked as you described.
However, after deleting the record, you need create the DataTable again

and
bind it to the grid. That will force the repeater to refresh.

L.L.
"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:OV**************@tk2msftngp13.phx.gbl...
I am having a strange problem. The program is a bit complex, but I'll try
to
simplify what I can. I apologize if this is complicated, but I think

this would still be simpler than posting a bunch of source code. If you want me
to post code, though, just say so.
In a nutshell, I've got an ASP.NET application that has one main ASPX

page.
On that ASPX page, it has a user control (an ASCX) that displays the

actual
data and controls I need.
On that user control, I have a drop-down list, and an asp:repeater tag

that
contains an asp:label tag that contains:
<%# DataBinder.Eval(Container.DataItem, "DESC") %> as the Text= field

That asp:repeater also contains an asp:imagebutton that is a "Delete"
button.
Basically, when the user makes a selection from the drop-down list, a

stored
procedure is called, and that data populates the asp:repeater (adding
an entry for each row retrieved by the stored procedure).
This part works fine.

The way it's set up, if the user clicks the "Delete" button after this

has been populated, it removes that entry from the database (which works
correctly), and then calls the code again to repopulate the repeater.
I've confirmed that this seems to work (the row does get deleted, and when the stored procedure is called, it returns the proper rows, without the "deleted" entry). But it does not appear to be refreshing the
repeater. The
repeater (in some cases) remains with the additional row still
showing, and
in other cases, blanks out entirely.
The code I use to populate is a function that calls the stored

procedure, and returns it in a DataTable. Then that DataTable is set up as the
DataSource of the repeater, and then does a .DataBind on it as well.
What am I missing? It seems to me that I need to force a refresh or

postback
or something. But I'm at a loss to figure out how to do that.
Can anyone help?
Thanks!



Nov 17 '05 #4

P: n/a
I have been able to confirm that the delete is actually happening on the
database. In fact, if I make another selection from the drop-down list (with
autopostback enabled), and then switch back to the original selection, it
shows exactly what it should (all the rows there previously, except for the
one deleted is gone).
Is there a way I can either force the postback (in ASP.NET), or somehow
prevent it from being cached in that way?
Thanks!
-Scott

"L. L." <ll**@cyence.com> wrote in message
news:uk**************@TK2MSFTNGP09.phx.gbl...
What about try the following,
After the row is deleted, close the browser. Double check to make sure the
row is actually deleted in the db. And then open the browser again to view
the page. If the row deleted is still in the data grid, the only thing I can think of is caching. Maybe the page or user control is being cached.

L.L.

"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
That's exactly what I'm doing.
In the module that does the delete, first it does the database call to
delete the row. Then it does the database call to re-populate the repeater
grid (and put that into the DataTable). Then it sets that DataTable to the source of the grid, and then binds the data.

In fact, I've even stepped it through the code, and I saw it step right
through each step as expected.
But oddly enough, it still never refreshed the grid on the form.
Thanks!
-Scott

"L. L." <ll**@cyence.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
Scott,

When the user clicks on the Delete button, the page will post back and call
the sp to delete the record. Apparently this part worked as you described. However, after deleting the record, you need create the DataTable again and
bind it to the grid. That will force the repeater to refresh.

L.L.
"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:OV**************@tk2msftngp13.phx.gbl...
> I am having a strange problem. The program is a bit complex, but
I'll
try
to
> simplify what I can. I apologize if this is complicated, but I think

this
> would still be simpler than posting a bunch of source code. If you want
me
> to post code, though, just say so.
>
>
> In a nutshell, I've got an ASP.NET application that has one main

ASPX page.
> On that ASPX page, it has a user control (an ASCX) that displays the
actual
> data and controls I need.
>
>
> On that user control, I have a drop-down list, and an asp:repeater tag that
> contains an asp:label tag that contains:
> <%# DataBinder.Eval(Container.DataItem, "DESC") %> as the Text= field >
> That asp:repeater also contains an asp:imagebutton that is a "Delete" > button.
>
>
> Basically, when the user makes a selection from the drop-down list, a stored
> procedure is called, and that data populates the asp:repeater (adding an > entry for each row retrieved by the stored procedure).
>
>
> This part works fine.
>
> The way it's set up, if the user clicks the "Delete" button after
this has
> been populated, it removes that entry from the database (which works
> correctly), and then calls the code again to repopulate the
repeater. >
>
> I've confirmed that this seems to work (the row does get deleted,

and when
> the stored procedure is called, it returns the proper rows, without

the > "deleted" entry). But it does not appear to be refreshing the repeater. The
> repeater (in some cases) remains with the additional row still showing, and
> in other cases, blanks out entirely.
>
>
> The code I use to populate is a function that calls the stored

procedure,
> and returns it in a DataTable. Then that DataTable is set up as the
> DataSource of the repeater, and then does a .DataBind on it as well.
>
>
> What am I missing? It seems to me that I need to force a refresh or
postback
> or something. But I'm at a loss to figure out how to do that.
>
>
> Can anyone help?
>
>
> Thanks!
>
>



Nov 17 '05 #5

P: n/a
The problem must be in the code. Can you post all your code?

L.L.
"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:ut****************@tk2msftngp13.phx.gbl...
I have been able to confirm that the delete is actually happening on the
database. In fact, if I make another selection from the drop-down list (with autopostback enabled), and then switch back to the original selection, it
shows exactly what it should (all the rows there previously, except for the one deleted is gone).
Is there a way I can either force the postback (in ASP.NET), or somehow
prevent it from being cached in that way?
Thanks!
-Scott

"L. L." <ll**@cyence.com> wrote in message
news:uk**************@TK2MSFTNGP09.phx.gbl...
What about try the following,
After the row is deleted, close the browser. Double check to make sure the
row is actually deleted in the db. And then open the browser again to view the page. If the row deleted is still in the data grid, the only thing I can
think of is caching. Maybe the page or user control is being cached.

L.L.

"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
That's exactly what I'm doing.
In the module that does the delete, first it does the database call to
delete the row. Then it does the database call to re-populate the repeater grid (and put that into the DataTable). Then it sets that DataTable to the source of the grid, and then binds the data.

In fact, I've even stepped it through the code, and I saw it step right through each step as expected.
But oddly enough, it still never refreshed the grid on the form.
Thanks!
-Scott

"L. L." <ll**@cyence.com> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
> Scott,
>
> When the user clicks on the Delete button, the page will post back and call
> the sp to delete the record. Apparently this part worked as you

described.
> However, after deleting the record, you need create the DataTable again and
> bind it to the grid. That will force the repeater to refresh.
>
> L.L.
> "Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM> wrote in > message news:OV**************@tk2msftngp13.phx.gbl...
> > I am having a strange problem. The program is a bit complex, but I'll try
> to
> > simplify what I can. I apologize if this is complicated, but I think this
> > would still be simpler than posting a bunch of source code. If you

want
me
> > to post code, though, just say so.
> >
> >
> > In a nutshell, I've got an ASP.NET application that has one main ASPX > page.
> > On that ASPX page, it has a user control (an ASCX) that displays the > actual
> > data and controls I need.
> >
> >
> > On that user control, I have a drop-down list, and an asp:repeater tag > that
> > contains an asp:label tag that contains:
> > <%# DataBinder.Eval(Container.DataItem, "DESC") %> as the Text= field > >
> > That asp:repeater also contains an asp:imagebutton that is a "Delete" > > button.
> >
> >
> > Basically, when the user makes a selection from the drop-down list, a
> stored
> > procedure is called, and that data populates the asp:repeater (adding
an
> > entry for each row retrieved by the stored procedure).
> >
> >
> > This part works fine.
> >
> > The way it's set up, if the user clicks the "Delete" button after

this has
> > been populated, it removes that entry from the database (which
works > > correctly), and then calls the code again to repopulate the

repeater. > >
> >
> > I've confirmed that this seems to work (the row does get deleted, and when
> > the stored procedure is called, it returns the proper rows, without the
> > "deleted" entry). But it does not appear to be refreshing the

repeater.
> The
> > repeater (in some cases) remains with the additional row still

showing,
> and
> > in other cases, blanks out entirely.
> >
> >
> > The code I use to populate is a function that calls the stored
procedure,
> > and returns it in a DataTable. Then that DataTable is set up as

the > > DataSource of the repeater, and then does a .DataBind on it as well. > >
> >
> > What am I missing? It seems to me that I need to force a refresh or > postback
> > or something. But I'm at a loss to figure out how to do that.
> >
> >
> > Can anyone help?
> >
> >
> > Thanks!
> >
> >
>
>



Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.