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("Positi onID")
Line 103:
Line 104:trace.warn( "txtQuestio n = " & txtQuestion.tex t)
*************** *************** *************** *************** *************** *************** *
Here is the asp code showing it as part of the EditItemTemplat e - so of course it doesn't exist when the page is first displayed(last line shows it):
*************** *************** *************** *************** *************** ***************
<EditItemTempla te>
<table border="1" width="100%" CellPadding="0" CellSpacing="0" style="margin:0 ">
<tr>
<td>
<asp:ImageButto n ID="ExpandButto n" runat="server" Font-Size="2" ImageUrl="../images/expand.gif" Width="16" Height="16" CommandName="Se lect" AlternateText=" Click here to see details"></asp:ImageButton >
</td>
<td>
<asp:ImageButto n ID="CollapseBut ton" visible="false" runat="server" Font-Size="2" ImageUrl="../images/collapse.gif" Width="16" Height="16" CommandName="Se lect" AlternateText=" Click here to see details"></asp:ImageButton >
<asp:label id="PositionID " Visible="false" runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "PositionID ") %>' />
<asp:label id="QuestionUni que" Visible="false" runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "QuestionUnique ") %>' />
</td>
<td width="100%">
<asp:TextBox id="txtQuestion " columns="60" MaxLength="50" runat="server" Text='<%# DataBinder.Eval (Container.Data Item, "Question") %>' />
*************** *************** *************** *************** *************** *************** *
Here is the trace.route showing it (I had to comment out the trace.warn statement to get it):
*************** *************** *************** *************** *************** ************
DataList1System .Web.UI.WebCont rols.DataList52 83100 DataList1:_ctl0 System.Web.UI.W ebControls.Data ListItem9860 DataList1:_ctl0 :_ctl2System.We b.UI.LiteralCon trol1340 DataList1:_ctl0 :ExpandButtonSy stem.Web.UI.Web Controls.ImageB utton1620 DataList1:_ctl0 :_ctl3System.We b.UI.LiteralCon trol460 DataList1:_ctl0 :CollapseButton System.Web.UI.W ebControls.Imag eButton00 DataList1:_ctl0 :_ctl4System.We b.UI.LiteralCon trol130 DataList1:_ctl0 :PositionIDSyst em.Web.UI.WebCo ntrols.Label032 DataList1:_ctl0 :_ctl5System.We b.UI.LiteralCon trol130 DataList1:_ctl0 :QuestionUnique System.Web.UI.W ebControls.Labe l028 DataList1:_ctl0 :_ctl6System.We b.UI.LiteralCon trol590
---> DataList1:_ctl0 :txtQuestion System.Web.UI.W ebControls.Text Box1650 DataList1:_ctl0 :_ctl7System.We b.UI.LiteralCon trol650 DataList1:_ctl0 :_ctl0System.We b.UI.WebControl s.Button670 DataList1:_ctl0 :_ctl8System.We b.UI.LiteralCon trol130 DataList1:_ctl0 :_ctl1System.We b.UI.WebControl s.Button670 DataList1:_ctl0 :_ctl9System.We b.UI.LiteralCon trol1220 DataList1:_ctl0 :DataGrid1Syste m.Web.UI.WebCon trols.DataGrid0 136 DataList1:_ctl0 :_ctl10System.W eb.UI.LiteralCo ntrol600 DataList1:_ctl1 System.Web.UI.W ebControls.Data ListItem400 *************** *************** *************** *************** *************** **************
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