I have a repeater control in an update panel that is updated every 10 seconds by a timer control. Each repeater item (that they have access to) contains a link button control with a command argument that is bound to the unique ID of the associated record
from the data source (SQL table). When the user clicks this link button, a modal popup appears that sets the unique ID passed via command argument to a session variable. Once the user enters the info needed, they click close on that modal popup and it fires
an event that takes the info in that modal popup and the session variable that was set and executes a sub to update the info in the SQL table based on the unique ID that was pulled from the session variable.
My problem is that I am seeing very rare instances where it appears that a user is getting the wrong unique ID and it is closing a repeater item other than the one they clicked. Meaning the session variable is being set to another value than the one being
clicked in for the bound repeater item link button. I don't believe it is the session variable but could be something to do with the repeater update every 10 seconds (index changed?). Any insight would assist and hopefully what I said makes sense as well
:) !
Here is what I have (viewstate and event validation is disabled on these pages currently). Comments preceeded with # aren't in the code. If I am doing anything that is redudant (or just dumb), please let me know, thanks!
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Get_Help()
End Sub
Protected Sub Get_Help()
Dim dpRequests As New PagedDataSource()
dpRequests.DataSource = ObjectDataSourceAll.Select
repHelp.DataSource = dpRequests
repHelp.DataBind()
End Sub
Protected Sub BtnAddItem_Click(ByVal sender As Object, ByVal e As EventArgs)
mdlPopupAdd.Show()
End Sub
Protected Sub BtnAddRequest_Click(ByVal sender As Object, ByVal e As EventArgs)
mdlPopupAdd.Hide()
#INSERTS DATA VIA SP, THIS WORKS PERFECTLY
Get_Help()
End Sub
Protected Sub BtnUpdateItem_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
Session("UniqueRequestID") = e.CommandArgument.ToString()
updPnlUpdateRequestDetail.Update()
mdlPopupUpdate.Show()
End Sub
Protected Sub BtnUpdateRequest_Click(ByVal sender As Object, ByVal e As EventArgs)
mdlPopupUpdate.Hide()
Dim myAdaptor As New HelpBLL
Dim AdLoginUpd As Integer = myAdaptor.GetUserID(DDL_Users.SelectedValue)
#IT UPDATES WITH THE WRONG SESSION VARIABLE HERE
myAdaptor.Update(Session("UniqueRequestID").ToString, AdLoginUpd, "Closed Request")
Get_Help()
End Sub
2- use UpdatePanel.Update inside the handler of timer event as you set it's updateMode to conditional so you should Update it as mentioned in each event to refine the data again.
If you feel it helps, Mark as answered so that it can help others to find solution.
For Any further questions, please contact me.
Marked as answer by espneon on Feb 14, 2012 02:50 PM
Thanks much, I made the change and moved the timer out of the update panel and added a trigger for the update panel. The timer event has the updatepanel.update function now as well. I'll need to watch it a while to see if it occurs again after the change
then mark this as answered (occured maybe 1-2 times a day).
espneon
Member
5 Points
3 Posts
Repeater Control Command Argument Issue
Feb 10, 2012 06:41 PM|LINK
I have a repeater control in an update panel that is updated every 10 seconds by a timer control. Each repeater item (that they have access to) contains a link button control with a command argument that is bound to the unique ID of the associated record from the data source (SQL table). When the user clicks this link button, a modal popup appears that sets the unique ID passed via command argument to a session variable. Once the user enters the info needed, they click close on that modal popup and it fires an event that takes the info in that modal popup and the session variable that was set and executes a sub to update the info in the SQL table based on the unique ID that was pulled from the session variable.
My problem is that I am seeing very rare instances where it appears that a user is getting the wrong unique ID and it is closing a repeater item other than the one they clicked. Meaning the session variable is being set to another value than the one being clicked in for the bound repeater item link button. I don't believe it is the session variable but could be something to do with the repeater update every 10 seconds (index changed?). Any insight would assist and hopefully what I said makes sense as well :) !
ajax Session Repeater
abdullahhaza...
Member
215 Points
46 Posts
Re: Repeater Control Command Argument Issue
Feb 12, 2012 12:53 PM|LINK
If available can you post the code used for this scenario
For Any further questions, please contact me.
espneon
Member
5 Points
3 Posts
Re: Repeater Control Command Argument Issue
Feb 13, 2012 02:50 PM|LINK
Here is what I have (viewstate and event validation is disabled on these pages currently). Comments preceeded with # aren't in the code. If I am doing anything that is redudant (or just dumb), please let me know, thanks!
<asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <br /> <table width="100%"> <h1> <asp:LinkButton ID="AddButton" runat="server" Text="Help!" OnClick="BtnAddItem_Click" Visible="True" /> </h1> <br /> <asp:Repeater ID="repHelp" runat="server"> <ItemTemplate> <%#Eval("Name")%> <asp:LinkButton ID="UpdateButton" runat="server" Text="[Close]" SkinID="DefaultLinkButton" OnCommand="BtnUpdateItem_Command" CommandArgument='<%#Eval("UniqueID")%>' Visible="True" /> </ItemTemplate> <SeparatorTemplate> <br /><br /> </SeparatorTemplate> </asp:Repeater> <br /> </table> <asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Get_Data" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" /> </Triggers> </asp:UpdatePanel> <asp:Button id="btnShowPopupAdd" runat="server" style="display:none" /> <ajaxToolKit:ModalPopupExtender ID="mdlPopupAdd" runat="server" TargetControlID="btnShowPopupAdd" PopupControlID="pnlPopupAdd" CancelControlID="btnCloseAdd" BackgroundCssClass="modalBackground" BehaviorID="ModalBehaviorAdd" /> <asp:Panel ID="pnlPopupAdd" runat="server" Width="300px" style="display:none"> <asp:UpdatePanel ID="updPnlAddRequestDetail" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="lblAddRequestDetail" runat="server" Text="Request Submission" BackColor="lightgray" Width="100%" /> <div style="background:white;"> <br /> <asp:DropDownList ID="DDL_RequestType" runat="server" AutoPostBack="False" DataSourceID="SqlDataSourceRequestType" DataTextField="MenuText" DataValueField="UniqueID" Width="100%" /> <p class="wrapContainer"> <div class="floatLeft"> <asp:Button ID="btnAdd" runat="server" Text="Add Submission" OnClick="BtnAddRequest_Click" Width="150px" /> <asp:Button ID="btnCloseAdd" runat="server" Text="Cancel" Width="50px" /> </div> <br /> <br /> </p> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> <asp:Button id="btnShowPopupUpdate" runat="server" style="display:none" /> <ajaxToolKit:ModalPopupExtender ID="mdlPopupUpdate" runat="server" TargetControlID="btnShowPopupUpdate" PopupControlID="pnlPopupUpdate" CancelControlID="btnCloseUpdate" BackgroundCssClass="modalBackground" BehaviorID="ModalBehaviorUpdate" /> <asp:Panel ID="pnlPopupUpdate" runat="server" Width="300px" style="display:none"> <asp:UpdatePanel ID="updPnlUpdateRequestDetail" runat="server" UpdateMode="Conditional"> <ContentTemplate> <div align="left" style="width:95%; background-color:#FFFFFF"> <asp:Label ID="lblUpdateRequestDetail" runat="server" Text="Update Submission" BackColor="lightgray" Width="100%" /> <div class="floatLeft"> <asp:Label ID="lblQuestion" runat="server" Text="Choose One:" Width="100%" /> </div> <asp:DropDownList ID="DDL_Users" runat="server" AutoPostBack="False" DataSourceID="SqlDataSourceHelpers" DataTextField="Name" DataValueField="Username" Width="100%" /> </div> </ContentTemplate> </asp:UpdatePanel> <div align="left" style="width:95%; background-color:#FFFFFF"> <table width="100%" height="100%"> <asp:Button ID="btnUpdate" runat="server" Text="Close Request" OnClick="BtnUpdateRequest_Click" Width="150px" /> <asp:Button ID="btnCloseUpdate" runat="server" Text="Cancel" Width="50px" OnClientClick="return false;" /> </table> </div> </asp:Panel>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Get_Help() End Sub Protected Sub Get_Help() Dim dpRequests As New PagedDataSource() dpRequests.DataSource = ObjectDataSourceAll.Select repHelp.DataSource = dpRequests repHelp.DataBind() End Sub Protected Sub BtnAddItem_Click(ByVal sender As Object, ByVal e As EventArgs) mdlPopupAdd.Show() End Sub Protected Sub BtnAddRequest_Click(ByVal sender As Object, ByVal e As EventArgs) mdlPopupAdd.Hide() #INSERTS DATA VIA SP, THIS WORKS PERFECTLY Get_Help() End Sub Protected Sub BtnUpdateItem_Command(ByVal sender As Object, ByVal e As CommandEventArgs) Session("UniqueRequestID") = e.CommandArgument.ToString() updPnlUpdateRequestDetail.Update() mdlPopupUpdate.Show() End Sub Protected Sub BtnUpdateRequest_Click(ByVal sender As Object, ByVal e As EventArgs) mdlPopupUpdate.Hide() Dim myAdaptor As New HelpBLL Dim AdLoginUpd As Integer = myAdaptor.GetUserID(DDL_Users.SelectedValue) #IT UPDATES WITH THE WRONG SESSION VARIABLE HERE myAdaptor.Update(Session("UniqueRequestID").ToString, AdLoginUpd, "Closed Request") Get_Help() End Subabdullahhaza...
Member
215 Points
46 Posts
Re: Repeater Control Command Argument Issue
Feb 13, 2012 03:09 PM|LINK
1- add timer as trigger to UpdatePanel
2- use UpdatePanel.Update inside the handler of timer event as you set it's updateMode to conditional so you should Update it as mentioned in each event to refine the data again.
For Any further questions, please contact me.
espneon
Member
5 Points
3 Posts
Re: Repeater Control Command Argument Issue
Feb 13, 2012 05:01 PM|LINK
Thanks much, I made the change and moved the timer out of the update panel and added a trigger for the update panel. The timer event has the updatepanel.update function now as well. I'll need to watch it a while to see if it occurs again after the change then mark this as answered (occured maybe 1-2 times a day).