I have a gridview in an update panel. I have added a Buttonfield to each cell to handle double-click events in the grid. In my rowcommand event I'm displaying a popupextender showing the cell contents. All this works fine.
My problem is that when the popup extender is displayed and I click in the window it causes it too flicker. I'm assuming this is some type of postback problem but not sure.
I tried wrapping all this in an update panel but it didn't make any difference. Not really sure what is causing this or how to prevent it.
I agree with cachet.net's opinion. In order to resolve your issue, you need to make sure that this issue will occur in all browsers at first. If it is, please set a break point in your project and debug your code step by step. That will help you to find
out the main issue.
If it doesn't work, I would suggest you simply your project and share the correspinding code. That will help us continue.
Best wishes,
Please mark the replies as answers if they help or unmark if not.
Feedback to us
Ok. so here is the code. The grid is in a user control page in an updatepanel. I tried it in IE, Firefox, and Chrome and whenever you mouse click in the popup window it flickers.
Here is the code behind. The grid is bound when a person pushes the Search button (not shown)
Protected Sub gvHIE_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvHIE.RowCommand
Dim _gridView As GridView = CType(sender, GridView)
_gridView.EditIndex = -1
' Get the selected index and the command name
Dim _selectedIndex As Integer = Integer.Parse(e.CommandArgument.ToString)
Dim _commandName As String = e.CommandName
Dim _eventArgument As String = Request.Form("__EVENTARGUMENT")
Dim cellData As String = ""
Dim lbl As Label
Select Case (_commandName)
Case "DoubleClick"
_gridView.SelectedIndex = _selectedIndex
If gvHIE.Rows(_selectedIndex).Cells(_eventArgument).HasControls Then
lbl = gvHIE.Rows(_selectedIndex).Cells(_eventArgument).Controls(1)
cellData = lbl.Text
txtModalMessage.Text = cellData
mpeMessage.Show()
End If
End Select
End Sub
Protected Sub gvHIE_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvHIE.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
If ((e.Row.RowState = DataControlRowState.Edit) _
OrElse (e.Row.RowState = (DataControlRowState.Edit Or DataControlRowState.Alternate))) Then
e.Row.Attributes.Clear()
Else
Dim cellIndex As Integer = 0
Do While (cellIndex < e.Row.Cells.Count)
Dim _doubleClickButton As LinkButton = CType(e.Row.Cells(0).Controls(0), LinkButton)
_doubleClickButton.Width = 500
_doubleClickButton.Style.Add("overflow", "hidden")
' Get the javascript which is assigned to this LinkButton
Dim _jsDouble As String = Page.ClientScript.GetPostBackClientHyperlink(_doubleClickButton, "")
' Add the cell index as the event argument parameter
_jsDouble = _jsDouble.Insert((_jsDouble.Length - 2), cellIndex.ToString)
' Add this javascript to the ondblclick Attribute of the row
e.Row.Cells(cellIndex).Attributes("ondblclick") = _jsDouble
cellIndex = (cellIndex + 1)
Loop
End If
End If
End Sub
Protected Overrides Sub Render(writer As System.Web.UI.HtmlTextWriter)
For Each r As GridViewRow In gvHIE.Rows
If (r.RowType = DataControlRowType.DataRow) Then
Dim cellIndex As Integer = 2
Do While (cellIndex < r.Cells.Count)
Page.ClientScript.RegisterForEventValidation((r.UniqueID + "$ctl00"), cellIndex.ToString)
Page.ClientScript.RegisterForEventValidation((r.UniqueID + "$ctl01"), cellIndex.ToString)
cellIndex = (cellIndex + 1)
Loop
End If
Next
MyBase.Render(writer)
End Sub
Ok. just an update on this stuff. Now I've noticed a different problem. After double-clicking in the grid's cell a couple of times everything stops working. The modal popup shows up nicely a couple of times then it quits working (double-clicking in the
grid does nothing). Also, I have a search button, some page navigation link buttons, and a rowcount dropdown. All of these stop responding after the modal popup is used a couple of times. I'm beginning to think it has something to do with being in an update
panel. I'm not sure. But none of the events will fire when it screws up.
I removed the update panel from the page and now when it errors an error page show up that says:
A potentially dangerous Request.Form value was detected from the client (ctl00$cphPageContent$ucHieReportControl$txtDetails="... Jabbar'
<ClinicalDocument><t...").
Tried adding the Debug="true" to page but it doesn't help. I'm wondering if the data could be the problem. The data in the cell is a combination of simple text and xml. Could it be thinking the xml is the dangerous part? Do I need to wrap the text somehow?
I also tried removing the modal popup and just assigned the data to a textbox. Still does the same thing on the 3rd doubleclick. Looks like if it was data related it wouldn't work at all.
rutledj
Member
25 Points
31 Posts
Postback problems
Jul 20, 2012 03:39 PM|LINK
I have a gridview in an update panel. I have added a Buttonfield to each cell to handle double-click events in the grid. In my rowcommand event I'm displaying a popupextender showing the cell contents. All this works fine.
My problem is that when the popup extender is displayed and I click in the window it causes it too flicker. I'm assuming this is some type of postback problem but not sure.
I tried wrapping all this in an update panel but it didn't make any difference. Not really sure what is causing this or how to prevent it.
cachet.net
Member
463 Points
110 Posts
Re: Postback problems
Jul 20, 2012 05:59 PM|LINK
First make sure that this flicks are coming in all browser, i want to suggest you to test on IE. I think you wont get this prob in IE
If your answer is yes share your code with us
Catherine Sh...
All-Star
23372 Points
2490 Posts
Microsoft
Re: Postback problems
Jul 24, 2012 07:37 AM|LINK
Hi,
I agree with cachet.net's opinion. In order to resolve your issue, you need to make sure that this issue will occur in all browsers at first. If it is, please set a break point in your project and debug your code step by step. That will help you to find out the main issue.
If it doesn't work, I would suggest you simply your project and share the correspinding code. That will help us continue.
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
rutledj
Member
25 Points
31 Posts
Re: Postback problems
Jul 24, 2012 12:10 PM|LINK
Ok. so here is the code. The grid is in a user control page in an updatepanel. I tried it in IE, Firefox, and Chrome and whenever you mouse click in the popup window it flickers.
<asp:GridView ID="gvHIE" runat="server" OnRowDataBound="gvHIE_RowDataBound"
AutoGenerateColumns="False" AllowSorting="True" OnRowCommand="gvHIE_RowCommand" ShowHeader="false">
<Columns>
<asp:ButtonField Text="DoubleClick" CommandName="DoubleClick" Visible="false"/>
<asp:BoundField DataField="fname" HeaderText="FName" Visible="True"
ReadOnly="true" ItemStyle-Wrap="false" >
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="lname" HeaderText="LName" Visible="True"
ReadOnly="true" ItemStyle-Wrap="false">
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="org" HeaderText="Org" Visible="True"
ReadOnly="true" ItemStyle-Wrap="false">
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="provider" HeaderText="Provider" Visible="True"
ReadOnly="true" ItemStyle-Wrap="false">
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="npi" HeaderText="NPI" Visible="True"
ReadOnly="true" ItemStyle-Wrap="false">
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="notetype" HeaderText="NoteType" Visible="True"
ReadOnly="true" ItemStyle-Wrap="false">
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="created_date" HeaderText="Create Date"
Visible="True" ReadOnly="true" ItemStyle-Wrap="false" >
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Note" >
<ItemTemplate>
<div class="gvNoteColWidth">
<asp:Label ID="lblNote" runat="server" Text='<%#Bind("note") %>'></asp:Label>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status Message" >
<ItemTemplate>
<div class="gvStatusColWidth">
<asp:Label ID="lblStatusMessage" runat="server" Text='<%#Bind("status_message") %>'></asp:Label>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<asp:Label ID="lblRowCount" runat="server" ></asp:Label>
<asp:Panel ID="pnlModalPopup" runat="server" width="820px" Height="420px" style="display:none;">
<asp:TextBox runat="server" ID="txtModalMessage" ReadOnly="True" TextMode="MultiLine" Width="800" Height="400px"></asp:TextBox>
<asp:Button ID="btnPopupClose" runat="server" Text="Close" OnClick="btnPopupClose_Click"/>
</asp:Panel>
<asp:ModalPopupExtender BackgroundCssClass="modalBackground" ID="mpeMessage" runat="server"
CancelControlID="btnPopupClose" PopupControlID="pnlModalPopup" TargetControlID="txtModalMessage"
RepositionMode="RepositionOnWindowResizeAndScroll">
<Animations>
<OnShowing>
<FadeIn Duration=".2" Fps="30"></FadeIn>
</OnShowing>
<OnShown>
<FadeIn Duration=".2" Fps="30"></FadeIn>
</OnShown>
</Animations>
</asp:ModalPopupExtender>
Here is the code behind. The grid is bound when a person pushes the Search button (not shown)
Protected Sub gvHIE_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvHIE.RowCommand
Dim _gridView As GridView = CType(sender, GridView)
_gridView.EditIndex = -1
' Get the selected index and the command name
Dim _selectedIndex As Integer = Integer.Parse(e.CommandArgument.ToString)
Dim _commandName As String = e.CommandName
Dim _eventArgument As String = Request.Form("__EVENTARGUMENT")
Dim cellData As String = ""
Dim lbl As Label
Select Case (_commandName)
Case "DoubleClick"
_gridView.SelectedIndex = _selectedIndex
If gvHIE.Rows(_selectedIndex).Cells(_eventArgument).HasControls Then
lbl = gvHIE.Rows(_selectedIndex).Cells(_eventArgument).Controls(1)
cellData = lbl.Text
txtModalMessage.Text = cellData
mpeMessage.Show()
End If
End Select
End Sub
Protected Sub gvHIE_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvHIE.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
If ((e.Row.RowState = DataControlRowState.Edit) _
OrElse (e.Row.RowState = (DataControlRowState.Edit Or DataControlRowState.Alternate))) Then
e.Row.Attributes.Clear()
Else
Dim cellIndex As Integer = 0
Do While (cellIndex < e.Row.Cells.Count)
Dim _doubleClickButton As LinkButton = CType(e.Row.Cells(0).Controls(0), LinkButton)
_doubleClickButton.Width = 500
_doubleClickButton.Style.Add("overflow", "hidden")
' Get the javascript which is assigned to this LinkButton
Dim _jsDouble As String = Page.ClientScript.GetPostBackClientHyperlink(_doubleClickButton, "")
' Add the cell index as the event argument parameter
_jsDouble = _jsDouble.Insert((_jsDouble.Length - 2), cellIndex.ToString)
' Add this javascript to the ondblclick Attribute of the row
e.Row.Cells(cellIndex).Attributes("ondblclick") = _jsDouble
cellIndex = (cellIndex + 1)
Loop
End If
End If
End Sub
Protected Overrides Sub Render(writer As System.Web.UI.HtmlTextWriter)
For Each r As GridViewRow In gvHIE.Rows
If (r.RowType = DataControlRowType.DataRow) Then
Dim cellIndex As Integer = 2
Do While (cellIndex < r.Cells.Count)
Page.ClientScript.RegisterForEventValidation((r.UniqueID + "$ctl00"), cellIndex.ToString)
Page.ClientScript.RegisterForEventValidation((r.UniqueID + "$ctl01"), cellIndex.ToString)
cellIndex = (cellIndex + 1)
Loop
End If
Next
MyBase.Render(writer)
End Sub
rutledj
Member
25 Points
31 Posts
Re: Postback problems
Aug 06, 2012 07:32 PM|LINK
Ok. just an update on this stuff. Now I've noticed a different problem. After double-clicking in the grid's cell a couple of times everything stops working. The modal popup shows up nicely a couple of times then it quits working (double-clicking in the grid does nothing). Also, I have a search button, some page navigation link buttons, and a rowcount dropdown. All of these stop responding after the modal popup is used a couple of times. I'm beginning to think it has something to do with being in an update panel. I'm not sure. But none of the events will fire when it screws up.
Ruchira
All-Star
42943 Points
7024 Posts
MVP
Re: Postback problems
Aug 07, 2012 01:50 PM|LINK
Hello,
Please check the browser console and see whether there are any errors.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.rutledj
Member
25 Points
31 Posts
Re: Postback problems
Aug 07, 2012 01:58 PM|LINK
I removed the update panel from the page and now when it errors an error page show up that says:
A potentially dangerous Request.Form value was detected from the client (ctl00$cphPageContent$ucHieReportControl$txtDetails="... Jabbar'
<ClinicalDocument><t...").
Tried adding the Debug="true" to page but it doesn't help. I'm wondering if the data could be the problem. The data in the cell is a combination of simple text and xml. Could it be thinking the xml is the dangerous part? Do I need to wrap the text somehow?
I also tried removing the modal popup and just assigned the data to a textbox. Still does the same thing on the 3rd doubleclick. Looks like if it was data related it wouldn't work at all.