Forums
This topic is locked
BC30451: Name 'Container' is not declared
Posted 26 Oct 2006 04:35:31
1
has voted
26 Oct 2006 04:35:31 David Poxon posted:
<font face='Arial'>I am looking for a little bit of help. I am using DreamweaverMX, ASP.NET VB and MS Access 2003.I am trying to assign two values from a Dreamweaver DataSet to two Session variables. My code is:
Dim sessionStaffID As String
Dim sessionAccess As String
sessionStaffID = login.FieldValue("staff.staffID", Container)
sessionAccess = login.FieldValue("access.access", Container)
If login.RecordCount > 0 then
Session("staffID" = sessionStaffID
Session("access" = sessionAccess
where login is a Dreamweaver DataSet.
I get the following error:
BC30451: Name 'Container' is not declared.
Any help would be greatly appreciated. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
</font id='Arial'>
Replies
Replied 10 Nov 2006 18:09:21
10 Nov 2006 18:09:21 Mike Mitchell replied:
I'm having the same problem and I did not find the "proper" solution, but I did find a cheesy workaround.
I created a form on the page and then bound the variable into a textbox (I later hid it from view with CSS). Then, in my function I read the value in the textbox. It actually worked fairly well and I was able to move on until I can work this out later.
<script runat="server">
Public Sub Page_Load(Src As Object, E As EventArgs)
If Not IsPostBack Then
DataBind()
End If
' Variable used to determine which page template to use
Dim varDTID as Integer = txtDTID.Text
' Let's go to template 1
If varDTID = 1 Then
Response.Redirect("dt1.aspx?QuestionOrder=" & Request.QueryString("QuestionOrder" & ""
End If
End Sub
</script>
. . .
<form name="formProcessor" id="formProcessor" runat="server">
DTID: <asp:TextBox ID="txtDTID" size="5" Text='<%# dtGetQuestion.FieldValue("Question_DTID", Container) %>' TextMode="SingleLine" runat="server" /><br>
</form>
----------------------------
Hope this helps.
I created a form on the page and then bound the variable into a textbox (I later hid it from view with CSS). Then, in my function I read the value in the textbox. It actually worked fairly well and I was able to move on until I can work this out later.
<script runat="server">
Public Sub Page_Load(Src As Object, E As EventArgs)
If Not IsPostBack Then
DataBind()
End If
' Variable used to determine which page template to use
Dim varDTID as Integer = txtDTID.Text
' Let's go to template 1
If varDTID = 1 Then
Response.Redirect("dt1.aspx?QuestionOrder=" & Request.QueryString("QuestionOrder" & ""
End If
End Sub
</script>
. . .
<form name="formProcessor" id="formProcessor" runat="server">
DTID: <asp:TextBox ID="txtDTID" size="5" Text='<%# dtGetQuestion.FieldValue("Question_DTID", Container) %>' TextMode="SingleLine" runat="server" /><br>
</form>
----------------------------
Hope this helps.
Replied 11 Aug 2007 19:04:47
11 Aug 2007 19:04:47 Fabian Betancur replied:
It took me a while to figure it out but this how you should do it:
replace contain with Nothing in VB or Null in C#
VB
sessionStaffID = login.FieldValue("staff.staffID", Nothing)
C#
sessionStaffID = login.FieldValue("staff.staffID", Null)
replace contain with Nothing in VB or Null in C#
VB
sessionStaffID = login.FieldValue("staff.staffID", Nothing)
C#
sessionStaffID = login.FieldValue("staff.staffID", Null)