Note that there are some explanatory texts on larger screens.

plurals
  1. POGridview disappearing on link click
    primarykey
    data
    text
    <p>I have a real precarious situation where my GridView disappears when a link is clicked on our production server.</p> <p>It works like this:</p> <ul> <li>User does a search, GridView gets generated</li> <li>On page generation, a link gets generated</li> <li>user clicks on the link, and the GridView disappears.</li> </ul> <p>In the past I've experienced issues where only the links would disappear because the links were being generated to late in the page life-cycle. But this time it seems to be different.</p> <p>What makes this even more bizarre is that this only happens on our production/live server on IIS. If I create a new site under IIS with the exact same compiled code, exact same DB connection strings, etc, the GridView works.</p> <p>Here is the section that contains the GridView:</p> <pre><code>&lt;div class="PGE_SearchResult"&gt; &lt;asp:Panel ID="pnlWrapper" runat="server" CssClass="addSearchPanelStyle"&gt; &lt;asp:GridView ID="gvExistingPatientsSearch" runat="server" AutoGenerateColumns="false" DataKeyNames="PatientId" CssClass="addSearchGridViewStyle" AlternatingRowStyle-CssClass="STD_GridView_AlternateRow" RowStyle-CssClass="STD_GridView_Row" HeaderStyle-CssClass="gvFixedHeader" FooterStyle-CssClass="STD_GridView_Footer" OnRowDataBound="gvExistingPatientsSearch_RowDataBound"&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="Patient ID" ItemStyle-CssClass="PGS_PSR_PatientID"&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID="lnkPatientSearch" runat="server" Text='&lt;%# Bind("PatientId")%&gt;' OnClick="OnPatientIDClick" CommandArgument='&lt;%# Eval("PatientId")+ ";" + Eval("PatientStatus")+ ";" + Eval("DOB") + ";" + Eval("DiseaseStates") + ";" + Eval("DiseaseStateIds")%&gt;'&gt;&lt;/asp:LinkButton&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="PatientName" HeaderText="Patient Name" ItemStyle-CssClass="PGS_PSR_Site"/&gt; &lt;asp:BoundField DataField="DOB" HeaderText="Date of Birth" HtmlEncode="False" ItemStyle-CssClass="PGS_PSR_DOB"/&gt; &lt;asp:TemplateField HeaderText="Site(s)" SortExpression="Site" ItemStyle-CssClass="PGS_PSR_Site"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblSiteSearch" runat="server" Text='&lt;%# Bind("Site")%&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="SiteMRN" HeaderText="Site MRN" HtmlEncode="False" ItemStyle-CssClass="PGS_PSR_DOB"/&gt; &lt;asp:TemplateField HeaderText="Disease State(s)" ItemStyle-CssClass="PGS_PSR_Site"&gt; &lt;ItemTemplate&gt; &lt;asp:Panel ID="diseaseStatePanel" runat="server"&gt; &lt;/asp:Panel&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/div&gt; </code></pre> <p>The code that generates the rows for the GridView is this:</p> <pre><code> protected void gvExistingPatientsSearch_RowDataBound(object sender, GridViewRowEventArgs e) { DataRowView patientData = (DataRowView)e.Row.DataItem; string diseaseStates = patientData["DiseaseStates"] as string; string diseaseStateIds = patientData["DiseaseStateIDs"] as string; int PatientID = (int)patientData["PatientId"]; int patientStatus = (int)patientData["PatientStatus"]; DateTime DOB = DateTime.Parse(patientData["DOB"] as string); if (e.Row.RowIndex != -1) { e.Row.Cells[2].Enabled = true; LinkButton lnkPatientSearch = (LinkButton)e.Row.FindControl("lnkPatientSearch"); lnkPatientSearch.Enabled = false; Panel diseaseStatePanel = (Panel)e.Row.FindControl("diseaseStatePanel"); BuildDiseaseStateLinks(diseaseStatePanel, diseaseStates, diseaseStateIds, PatientID, patientStatus, DOB, true); } } </code></pre> <p>The following is the method <code>BuildDiseaseStatelinks()</code></p> <pre><code>private void BuildDiseaseStateLinks(Panel diseaseStatePanel, string diseaseStates, string diseaseStateIDs, int PatientID, int patientStatus, DateTime DOB, bool isAllowed) { string[] diseaseStateIdsSplit = diseaseStateIDs.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); string[] diseaseStateSplit = diseaseStates.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i &lt; diseaseStateSplit.Length; i++) { string diseaseState = diseaseStateSplit[i]; string diseaseStateID = diseaseStateIdsSplit[i]; LinkButton diseaseStateLink = new LinkButton(); diseaseStateLink.Attributes.Add("style", "float:left"); diseaseStateLink.Text = diseaseState; diseaseStateLink.CommandArgument = PatientID + "|" + patientStatus + "|" + DOB.ToShortDateString() + "|" + diseaseState + "|" + diseaseStateID; if (isAllowed) { diseaseStateLink.CommandArgument += "|Allowed"; } else { diseaseStateLink.CommandArgument += "|NotAllowed"; } diseaseStateLink.CommandName = "OnDiseaseStateLinkClick"; diseaseStateLink.Command += new CommandEventHandler(OnDiseaseStateLinkClick); diseaseStatePanel.Controls.Add(diseaseStateLink); if (i &lt; diseaseStateSplit.Length - 1) { Label splitLabel = CreatePipeLabel(); diseaseStatePanel.Controls.Add(splitLabel); } } } </code></pre> <p>The <code>gvExistingPatientsSearch</code> gets bound in 2 places, when the search button is clicked, and on <code>Page_Load</code>, but only if the user was redirected to the current page with a search as the <code>QueryString</code>.</p> <p>Once a link has been clicked, a few <code>Session</code> variables get set (the ones found on the <code>CommandArguments</code> set in <code>BuildDiseaseStateLinks</code> and the user is redirected to another page.</p> <p>What could I possibly be missing? Code is the same, DB is the same, IIS settings are identical (except for the Application Pools, one is using classic (the Prod/Live) and the other Integrated; I switched Prod/Live to Integrated and that didn't do anything. </p> <p>Suggestions, comments, anything!</p> <p>Thanks in advance.</p> <p><strong>[EDIT]</strong>: Added some code as requested. Didn't originally do it since I figured the code may not be the issue. It works in one version and not the other.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload