Access Web Form Control

C

chessitguy

I have a simple Wizard
page.aspx
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" >
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Main">

<Acme:Main runat="server" id="MainWC" />

</asp:WizardStep>
</WizardSteps>
</asp:Wizard>

with a web control
page.ascx
<asp:DropDownList ID="CorrectionType" runat="server">
<asp:ListItem Value="None" Selected=True>None</asp:ListItem>
<asp:ListItem Value="Gift">Gift</asp:ListItem>
<asp:ListItem Value="Membership">Membership</asp:ListItem>
<asp:ListItem Value="Gift and Membership">Gift and
Membership</asp:ListItem>
</asp:DropDownList>


I'm trying to set the "CorrectionType.Text" value equal to a
code-behind file Session Variable.
like
page.aspx.cs
Sesssion["CorrectionType"] = MainWC.CorrectionType.Text;

Basically, trying to set the CorrectionType on a Web Control equal to a
Session in the code-behind file.

Oh, when I try this I get:

'ASP.development_z1_forms_main_ascx.CorrectionType' is inaccessible due
to its protection level..
Thanks.
 
B

Brian Williams

Try something like this:

DropDownList ddlCorrectionType =
(DropDownList)MainWC.FindControl("CorrectionType");
Session["CorrectionType"] = ddlCorrectionType.Text;

Regards,
Brian K. Williams
 
C

chessitguy

You Rock! That worked. Is there an online resource that has more
information on Web Control topics that you recommend?


Thanks.
vj

Brian said:
Try something like this:

DropDownList ddlCorrectionType =
(DropDownList)MainWC.FindControl("CorrectionType");
Session["CorrectionType"] = ddlCorrectionType.Text;

Regards,
Brian K. Williams



I have a simple Wizard
page.aspx
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" >
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Main">

<Acme:Main runat="server" id="MainWC" />

</asp:WizardStep>
</WizardSteps>
</asp:Wizard>

with a web control
page.ascx
<asp:DropDownList ID="CorrectionType" runat="server">
<asp:ListItem Value="None" Selected=True>None</asp:ListItem>
<asp:ListItem Value="Gift">Gift</asp:ListItem>
<asp:ListItem Value="Membership">Membership</asp:ListItem>
<asp:ListItem Value="Gift and Membership">Gift and
Membership</asp:ListItem>
</asp:DropDownList>


I'm trying to set the "CorrectionType.Text" value equal to a
code-behind file Session Variable.
like
page.aspx.cs
Sesssion["CorrectionType"] = MainWC.CorrectionType.Text;

Basically, trying to set the CorrectionType on a Web Control equal to a
Session in the code-behind file.

Oh, when I try this I get:

'ASP.development_z1_forms_main_ascx.CorrectionType' is inaccessible due
to its protection level..
Thanks.
 
B

Brian Williams

My favorite place for code examples is http://www.codeproject.com or
http://www.gotdotnet.com
and don't forget about the newsgroup
microsoft.public.dotnet.framework.aspnet.webcontrols.


NP, glad I could help...
Brian



You Rock! That worked. Is there an online resource that has more
information on Web Control topics that you recommend?


Thanks.
vj

Brian said:
Try something like this:

DropDownList ddlCorrectionType =
(DropDownList)MainWC.FindControl("CorrectionType");
Session["CorrectionType"] = ddlCorrectionType.Text;

Regards,
Brian K. Williams



I have a simple Wizard
page.aspx
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" >
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Main">

<Acme:Main runat="server" id="MainWC" />

</asp:WizardStep>
</WizardSteps>
</asp:Wizard>

with a web control
page.ascx
<asp:DropDownList ID="CorrectionType" runat="server">
<asp:ListItem Value="None" Selected=True>None</asp:ListItem>
<asp:ListItem Value="Gift">Gift</asp:ListItem>
<asp:ListItem Value="Membership">Membership</asp:ListItem>
<asp:ListItem Value="Gift and Membership">Gift and
Membership</asp:ListItem>
</asp:DropDownList>


I'm trying to set the "CorrectionType.Text" value equal to a
code-behind file Session Variable.
like
page.aspx.cs
Sesssion["CorrectionType"] = MainWC.CorrectionType.Text;

Basically, trying to set the CorrectionType on a Web Control equal to a
Session in the code-behind file.

Oh, when I try this I get:

'ASP.development_z1_forms_main_ascx.CorrectionType' is inaccessible due
to its protection level..
Thanks.
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top