J
Jack
Hello,
After I moved my Checkbox control 'inside' a <asp:LoginView />, my
code-behind file isn't compiling saying that:
"The name 'MyCheckbox' does not not exist in the current context."
Basically, when the 'administrator', and only the administrator, logs into
the site (from another page), I want him to check a checkbox on this page.
It all worked fine with anonymous access before (without the username and
roles set up). I'm not too sure why one shouldn't access the ASP controls
from code.
How can my code-behind file access ASP.NET 2.0 controls on my webpage when
the controls are embedded inside a <asp:LoginView> ?
It looks like this:
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
Anonymous template here...
</AnonymousTemplate>
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
<asp:LoginStatus ID="LoginStatus" runat="server"
LogoutImageUrl="Graphics/logout.jpg" Visible="false" />
<asp:Button ID="ButtonInsertNew" runat="server"
Text="Insert New" OnClick="ButtonInsertNew_Click" />
<asp:Label ID="LabelError" runat="server"
ForeColor="Red" Width="625px"></asp:Label>
<aspanel ID="PanelFileUpload" runat="server" >
<asp:CheckBox ID="CheckBoxPDF" runat="server"
AutoPostBack="True"
OnCheckedChanged="CheckBoxPDF_CheckedChanged"
Text="PDF Filename" Width="125" />
<asp:FileUpload ID="FileUploadPDF"
runat="server" Enabled="False" />
</aspanel>
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
Thanks,
Jack.
After I moved my Checkbox control 'inside' a <asp:LoginView />, my
code-behind file isn't compiling saying that:
"The name 'MyCheckbox' does not not exist in the current context."
Basically, when the 'administrator', and only the administrator, logs into
the site (from another page), I want him to check a checkbox on this page.
It all worked fine with anonymous access before (without the username and
roles set up). I'm not too sure why one shouldn't access the ASP controls
from code.
How can my code-behind file access ASP.NET 2.0 controls on my webpage when
the controls are embedded inside a <asp:LoginView> ?
It looks like this:
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
Anonymous template here...
</AnonymousTemplate>
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
<asp:LoginStatus ID="LoginStatus" runat="server"
LogoutImageUrl="Graphics/logout.jpg" Visible="false" />
<asp:Button ID="ButtonInsertNew" runat="server"
Text="Insert New" OnClick="ButtonInsertNew_Click" />
<asp:Label ID="LabelError" runat="server"
ForeColor="Red" Width="625px"></asp:Label>
<aspanel ID="PanelFileUpload" runat="server" >
<asp:CheckBox ID="CheckBoxPDF" runat="server"
AutoPostBack="True"
OnCheckedChanged="CheckBoxPDF_CheckedChanged"
Text="PDF Filename" Width="125" />
<asp:FileUpload ID="FileUploadPDF"
runat="server" Enabled="False" />
</aspanel>
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
Thanks,
Jack.