Question

I've already posted this to DevExpress support, but since I honestly have zero confidence in their ability to resolve the problem, I'm posting it here.

I have a User Control containing a ASPxGridView whose first column I need to hide depending upon the value of a property defined on the control. The property takes the value passed in and assigns it to the Visible property of the grid.

On one page, I have this property set to True; the other, False. When I visit the page where the column should be hidden first and navigate to the other page, the column stays hidden. When I visit the page where it should be visible first and then navigate to the other page, it throws an error b/c the column is defined as such:

<dx:GridViewDataTextColumn Caption="Employee" FieldName="TSLinkText" VisibleIndex="0">
    <DataItemTemplate>
       <a href='<%#GlobalHelper.GetTimesheetURL(Eval("TimesheetID"), Eval("EmployeeID"), Eval("HasTSLink")) %>'
          title='View the current timesheet for <%#Eval("TSLinkText")%>'>
      <%#IIf(Eval("HasTSLink") = -1, Eval("TSLinkText"), "")%></a>
      <%#IIf(Eval("HasTSLink") = 0, Eval("TSLinkText"), "")%>
     </DataItemTemplate>
    <CellStyle Wrap="False" />
</dx:GridViewDataTextColumn>
                        ​

I've got a different datasource defined on each page, and on the page where the column is hidden, the procedure that retrieves the data does not have a "HasTSLink" field, which is why the error is thrown.

​To me, it seems like the User Control is being cached. I tried a few different approaches, including adjusting the VaryByControls property for Partial Caching, but nothing has worked so far.

Was it helpful?

Solution

Apparently, the problem had to do with having the same ID on the UserControl on both pages. It seems that the control was being cached and reloaded as if it were the exact same control despite it being on a different page.

I'm not sure if this applies to anything besides my specific issue, but if you ever encounter something like this in your own projects, it's worth a try.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top