I am getting an error on a object name that doesn't exist (according to asp.net), but if you look at the trace, it does.
Here is the error:
************************************************** *****************************************
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'txtQuestion' is not declared.
Source Error:
Line 102: Dim positionID as Integer = Session("PositionID")
Line 103:
Line 104:trace.warn("txtQuestion = " & txtQuestion.text)
************************************************** *****************************************
Here is the asp code showing it as part of the EditItemTemplate - so of course it doesn't exist when the page is first displayed(last line shows it):
************************************************** ****************************************
<EditItemTemplate>
<table border="1" width="100%" CellPadding="0" CellSpacing="0" style="margin:0">
<tr>
<td>
<asp:ImageButton ID="ExpandButton" runat="server" Font-Size="2" ImageUrl="../images/expand.gif" Width="16" Height="16" CommandName="Select" AlternateText="Click here to see details"></asp:ImageButton>
</td>
<td>
<asp:ImageButton ID="CollapseButton" visible="false" runat="server" Font-Size="2" ImageUrl="../images/collapse.gif" Width="16" Height="16" CommandName="Select" AlternateText="Click here to see details"></asp:ImageButton>
<asp:label id="PositionID" Visible="false" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "PositionID") %>' />
<asp:label id="QuestionUnique" Visible="false" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "QuestionUnique") %>' />
</td>
<td width="100%">
<asp:TextBox id="txtQuestion" columns="60" MaxLength="50" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Question") %>' />
************************************************** *****************************************
Here is the trace.route showing it (I had to comment out the trace.warn statement to get it):
************************************************** *************************************
DataList1System.Web.UI.WebControls.DataList5283100 DataList1:_ctl0System.Web.UI.WebControls.DataListI tem9860 DataList1:_ctl0:_ctl2System.Web.UI.LiteralControl1 340 DataList1:_ctl0:ExpandButtonSystem.Web.UI.WebContr ols.ImageButton1620 DataList1:_ctl0:_ctl3System.Web.UI.LiteralControl4 60 DataList1:_ctl0:CollapseButtonSystem.Web.UI.WebCon trols.ImageButton00 DataList1:_ctl0:_ctl4System.Web.UI.LiteralControl1 30 DataList1:_ctl0:PositionIDSystem.Web.UI.WebControl s.Label032 DataList1:_ctl0:_ctl5System.Web.UI.LiteralControl1 30 DataList1:_ctl0:QuestionUniqueSystem.Web.UI.WebCon trols.Label028 DataList1:_ctl0:_ctl6System.Web.UI.LiteralControl5 90
---> DataList1:_ctl0:txtQuestion System.Web.UI.WebControls.TextBox1650 DataList1:_ctl0:_ctl7System.Web.UI.LiteralControl6 50 DataList1:_ctl0:_ctl0System.Web.UI.WebControls.But ton670 DataList1:_ctl0:_ctl8System.Web.UI.LiteralControl1 30 DataList1:_ctl0:_ctl1System.Web.UI.WebControls.But ton670 DataList1:_ctl0:_ctl9System.Web.UI.LiteralControl1 220 DataList1:_ctl0:DataGrid1System.Web.UI.WebControls .DataGrid0136 DataList1:_ctl0:_ctl10System.Web.UI.LiteralControl 600 DataList1:_ctl1System.Web.UI.WebControls.DataListI tem400 ************************************************** ***************************************
This does not show up on the first page (as we are not in edit mode yet), but I am getting the error before the first page is executed. We do not go into this subroutine except during editing mode - when the object would exist.
Why would I get the error at this time and how do I get around this?
Thanks
Tom