I'm trying to populate the site menu on the site master page, according to the current user's role. For some reason, the C# code behind file does not recognize the SqlDataSource nor some other hidden fields that I put on the mater page's aspx code. here's my code:
ASP:
<form id="Form1" runat="server">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
<asp:SqlDataSource ID="getButtons" runat="server" ConnectionString="<%$ ConnectionStrings:RMSConnectionString %>" SelectCommand="sp_getSiteMasterButtons" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="idsid" Name="idsid" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:HiddenField ID="idsid" runat="server" />
</asp:ContentPlaceHolder>
</form>
C# code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Windows.Forms;
using System.Data.SqlClient;
public partial class SiteMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
idsid.Value = Environment.UserName;
getButtons.DataBind();
}
}
Error 1449 The name 'idsid' does not exist in the current context
Error 1450 The name 'getButtons' does not exist in the current context
Thanks all