s.Jayanthi
December 21st, 2008, 01:21 PM
I using ASP.net2.0, C#
i have generated a dynamic databound heirarchical menucontrol using xslt in my master page.
i have to make the menuitems invisible/disabled based on user rights..
eg: admin -having -rights as 1234 then ..the menu should show the 1234 menuitems only
i have tried " Menu.Items[0].selectable= false." but its not working.
Each user has set of permissions to view the menuItems.
i have used this code to populate in menucontrol.
DataSet ds = new DataSet();
// string connStr = "server=localhost;trusted_Connection=true;database=Satyam";
string connStr = "Data source=SATHYAM;uid=sa;password=p@ssw0rd;database=Backoffice";
using (SqlConnection conn = new SqlConnection(connStr))
{
// string ***= 1s2s1s3s;
string sql = "Select MenuID,Text,Link,ParentID from tbl_ConfigDynamicMenu ";//where ='"+ ***+"'";
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
da.Dispose();
}
ds.DataSetName = "Menus";
ds.Tables[0].TableName = "tbl_ConfigDynamicMenu";
DataRelation relation = new DataRelation("ParentChild",
ds.Tables["tbl_ConfigDynamicMenu"].Columns["MenuID"],
ds.Tables["tbl_ConfigDynamicMenu"].Columns["ParentID"],
true);
relation.Nested = true;
ds.Relations.Add(relation);
XmlDataSource.Data = ds.GetXml();
//ds.Relations.IndexOf(relation);
if (Request.Params["Sel"] != null)
Page.Response.Redirect(Page.Request.Params["Sel"], false);
kindly suggest me...
thanks.
i have generated a dynamic databound heirarchical menucontrol using xslt in my master page.
i have to make the menuitems invisible/disabled based on user rights..
eg: admin -having -rights as 1234 then ..the menu should show the 1234 menuitems only
i have tried " Menu.Items[0].selectable= false." but its not working.
Each user has set of permissions to view the menuItems.
i have used this code to populate in menucontrol.
DataSet ds = new DataSet();
// string connStr = "server=localhost;trusted_Connection=true;database=Satyam";
string connStr = "Data source=SATHYAM;uid=sa;password=p@ssw0rd;database=Backoffice";
using (SqlConnection conn = new SqlConnection(connStr))
{
// string ***= 1s2s1s3s;
string sql = "Select MenuID,Text,Link,ParentID from tbl_ConfigDynamicMenu ";//where ='"+ ***+"'";
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
da.Dispose();
}
ds.DataSetName = "Menus";
ds.Tables[0].TableName = "tbl_ConfigDynamicMenu";
DataRelation relation = new DataRelation("ParentChild",
ds.Tables["tbl_ConfigDynamicMenu"].Columns["MenuID"],
ds.Tables["tbl_ConfigDynamicMenu"].Columns["ParentID"],
true);
relation.Nested = true;
ds.Relations.Add(relation);
XmlDataSource.Data = ds.GetXml();
//ds.Relations.IndexOf(relation);
if (Request.Params["Sel"] != null)
Page.Response.Redirect(Page.Request.Params["Sel"], false);
kindly suggest me...
thanks.