var doesnt show up in context.items but others do

D

dave

This little problem is driving me nuts!!

On my webform page I create 2 variables..

Protected p_dml As String = "I"

Public Const mwv_id As Integer = 0

' originally had mwv_id as Protected

then in my form button click I set up my context items..

Private Sub btnAddRecord_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddRecord.Click

Dim mwindicator As Integer


Context.Items.Add ("Table",Me.lsttables.SelectedValue)


Context.Items ("p_dml") = p_dml
Context.Items ("mwv_id") = mwv_id




Context.Items ("WageAmount") = Me.txtAmount.Text
Context.Items ("MWindicator") =
Convert.ToInt16(Me.cbIndicator.checked)
Context.Items ("DateEffective") = Me.txtDateEff.Text
Context.Items ("DateExpire") = Me.txtDateExpire.Text
Context.Items ("Rate_Type") = Me.ddlrate_type.SelectedValue
Context.Items("Province") = Me.ddlProvinces.SelectedValue
Context.Items ("Variation_id") = Me.ddlVariations.SelectedValue
Context.Items ("Jurisdiction_id") = Me.ddljurisdiction.SelectedValue
'Response.Write ("mwv_id = " & mwv_id & "<br>")
'Response.Write ("so context mwv+id = " & Context.Items ("mwv_id"))




Server.Transfer("index.aspx?action=act_add_record", True)

End Sub

So on my act_add_record.ascx I send everything to an oracle package..
but it bombs..

So when I response .write out my context vars..

Response.Write ("Table is " & Context.Items ("Table") & "<br>")
Response.Write ("MWV_ID is " & Context.Items ("wmv_id") & "<br>")
Response.Write ("p_dml is " & Context.Items ("p_dml") & "<br>")
Response.Write ("Province is " & Context.Items ("Province") & "<br>")
Response.Write ("Rate type is " & Context.Items ("Rate_Type") &
"<br>")
Response.Write ("Wage Amount is " & Context.Items ("WageAmount") &
"<br>")
Response.Write ("Indicator is " & Context.Items ("MWindicator") &
"<br>")
Response.Write ("Effective date is " & Context.Items ("DateEffective")
& "<br>")
Response.Write ("Expiry date is " & Context.Items ("DateExpire")&
"<br>")
Response.Write ("Jurisdiction_id is " & Context.Items
("Jurisdiction_id")& "<br>")
Response.Write ("Variation_id is " & Context.Items ("Variation_id")&
"<br>")

Everything shows as expected but the mwv_id is blank (which I suspect
is why my package bombs)!!

Table is MINIMUM_WAGE
MWV_ID is
p_dml is I
Province is 36
Rate type is 1
Wage Amount is 9.99
Indicator is 1
Effective date is 2004-11-29
Expiry date is 2004-11-30
Jurisdiction_id is 1
Variation_id is 0

Can anyone see what I've done wrong!

tia
Dave
 
K

Karl Seguin

Dave,
I don't see the specific problem, but why wouldn't you simply access mwv_id
directly ? It's a public constant, you can simply access it from the
index.aspx's codebehind (or any other class) via

PageName.mwv_id

like, if your webform is like this:

public class SomePage
Inherits System.Web.UI.Page

protected p_dml as string = "I"
public const mwv_id as Integer = 0

...
end class

you can access mwv_id from anywhere via:
SomePage.mwv_id


Karl
 
D

dave

thx Karl


your solution works great, and exposes my lack of oop understanding.

its still odd that the p_dml variable comes through the
server.transfer unscathed but mwv_id becomes a blank..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top