
Untitled
By: a guest on
May 31st, 2012 | syntax:
None | size: 1.04 KB | hits: 26 | expires: Never
The name xxx does not exist in the current context
<LoggedInTemplate>
<b>Login ok ! </b><br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
InsertCommand="INSERT INTO aspnet_PicturesHome(pUrl) VALUES (@pUrl)"
SelectCommand="SELECT pID, pUrl FROM aspnet_PicturesHome">
<InsertParameters>
<asp:ControlParameter Name="pUrl" Type="String" ControlID="FileUpload1" PropertyName="FileName"/>
</InsertParameters>
</asp:SqlDataSource>
<asp:Label ID="Label1" runat="server" Text="Label">Foto upload: </asp:Label>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Upload" />
<br></br>
</LoggedInTemplate>
FileUpload fu = LoginView1.FindControl("FileUpload1") as FileUpload;
protected void Page_Load(object sender, EventArgs e){
if(!this.isPostBack)
{
if(!Context.User.IsInRole("admin"))
{
//disable controls
}
}
}