I have two listviews, one where the data is displayed and another where I insert data (InsertItemTemplate). When the button on the first one is clicked and data is entered in the database i want the other one to update.
This is how i tried so far:
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Add movie" OnClick="InsertButton_OnClick" />
And in the aspx file:
protected void InsertButton_OnClick(object sender, EventArgs e)
{
Response.Redirect(Request.RawUrl);
}
When i use “Response.Redirect(Request.RawUrl);” my data is not entered, so that will not work. What should I use instead to get this to work?
Thanks in advance!
Handle the
ItemInsertedevent and removeOnClick="InsertButton_OnClick"from InsertButton.I believe the issue is because Click event is first fired and then later the bubbled event (ItemInserted in this case). The redirect terminates any code execution.