C
Cederstrom
Hello Group,
I have created an ASP.NET page. The page consist of the following items:
- Button A
- Button B
- UserControl
When I press Button A, I execute the following code:
ViewState["pdbmode"] = "edit";
Session["pdbmode"] = "edit";
When I press Button B, I execute the following code:
ViewState["pdbmode"] = "create";
Session["pdbmode"] = "create";
In my UserControl PageLoad() I have the following code:
if (ViewState["pdbmode"] == null)
Label1.Text = "Null";
else if(ViewState["pdbmode"] == "edit")
Label1.Text = "Edit";
else if(ViewState["pdbmode"] == "create")
Label1.Text = "Create";
else
Label1.Text = "Unknown";
if (Session["pdbmode"] == null)
Label2.Text = "Null";
else if(Session["pdbmode"] == "edit")
Label2.Text = "Edit";
else if(Session["pdbmode"] == "create")
Label2.Text = "Create";
else
Label2.Text = "Unknown";
---
The problem is that when I press Button A, Label1 which uses ViewState never
changes away from being Null.
Label2 Changes, but I it changes too late. I press Button A, Label2 stays
"null", then I press Button A and it changes to edit.
I guess I need to do this completly different, but how?
Basically I just need my UserControl to know if ButtonA was pressed, or
ButtonB was pressed.
I hope someone can help me, please
- Cederström
I have created an ASP.NET page. The page consist of the following items:
- Button A
- Button B
- UserControl
When I press Button A, I execute the following code:
ViewState["pdbmode"] = "edit";
Session["pdbmode"] = "edit";
When I press Button B, I execute the following code:
ViewState["pdbmode"] = "create";
Session["pdbmode"] = "create";
In my UserControl PageLoad() I have the following code:
if (ViewState["pdbmode"] == null)
Label1.Text = "Null";
else if(ViewState["pdbmode"] == "edit")
Label1.Text = "Edit";
else if(ViewState["pdbmode"] == "create")
Label1.Text = "Create";
else
Label1.Text = "Unknown";
if (Session["pdbmode"] == null)
Label2.Text = "Null";
else if(Session["pdbmode"] == "edit")
Label2.Text = "Edit";
else if(Session["pdbmode"] == "create")
Label2.Text = "Create";
else
Label2.Text = "Unknown";
---
The problem is that when I press Button A, Label1 which uses ViewState never
changes away from being Null.
Label2 Changes, but I it changes too late. I press Button A, Label2 stays
"null", then I press Button A and it changes to edit.
I guess I need to do this completly different, but how?
Basically I just need my UserControl to know if ButtonA was pressed, or
ButtonB was pressed.
I hope someone can help me, please
- Cederström