Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

repeater.bind() ?

I have a datagrid on my page, this datagrid acts as an edit/delete for some table data.
The table data just happens to be the data that populates a repeater (and in turn a marquee tag) at the foot of the page. Problem is that when the datagrid is edited or a row deleted the repeater data does not refresh of re-bind() and I can't seem to find an event to achieve this. The datagrid code is pretty standard. The code for the repeater is....

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<itemTemplate>
<marquee id="Marquee1" runat="server" ><%# Eval("NoticeText") %></marquee>
</itemTemplate>
</asp:Repeater>
0
QPR
Asked:
QPR
  • 2
1 Solution
 
Ajay SharmaCommented:
after updating data in the datagrid use this
it will rebind the data, and the values will be refreshed

Repeater1.DataSource=SqlDataSource1
DataBind()
0
 
chinu1310Commented:
When you delete a record or update a row , you are calling datagrid update and delete events.
What you have to do as suggested by ajaysharmaapjs you have to reinitialize the DataSource Property of the Repeater control and bind it.

Hope it helps
0
 
QPRAuthor Commented:
Having a strange problem,
Opened the code behind and added this....
Public Sub gridview1_RowUpdated(ByVal sender As Object, ByVal e As System.EventArgs)
        Repeater1.DataSource = SqlDataSource1
        DataBind()
    End Sub

but I get the message that Repeater1 and SqlDatasource1 are not declared
0
 
QPRAuthor Commented:
ok I'm getting there, I had the inherits attribute wrong in the aspx page.

When I launch the page their is no marquee (so I'm guessingit is no longer bound when the page loads) so I put this in the code behind (below) but now I don't get the marquee onpage load or after the gridview has been updated. In other words it's gone!

Partial Class Admin_NoticeAdmin
    Inherits System.Web.UI.Page

    Public Sub gridview1_RowUpdated(ByVal sender As Object, ByVal e As System.EventArgs)
        Repeater1.DataSource = SqlDataSource1
        DataBind()
    End Sub


    Protected Sub body_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles body.Load
        Repeater1.DataBind()
    End Sub
End Class
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now