NetSqlAzMan with javascript

Mar 5, 2010 at 2:35 PM
Edited Mar 5, 2010 at 2:36 PM

Hi,

I can get all the roles for the store I have created with the following code in my code behind.

IAzManApplication application = storage.GetApplication("MyApplication");ItemType.Role);

IAzManItem[] roles = application.GetItems(ItemType.Role);

I am using a JQuery dialog to display the roles to users and I am creating checkboxes for each role so that users can check/uncheck them.  How do I get the roles from asp.net code behind into my javascript js file which is attached to the aspx file?

I realise this isn't strickly a NetSqlAzMan question but I would be greatful for any pointers?

 

Coordinator
Mar 5, 2010 at 3:08 PM

Hi,

you can do this:

protected void Page_Load()

{

String clientRoles = String.Join(from t in application.GetItems(ItemType.Role) select t.ItemName, “,”);

this.Page.ClientScript.RegisterStartUpScript(“clientRoles”, typeof(String), String.Format(“var clientRoles = [{0}];”, clientRoles);

}

And then use a JQuery client scripting to access the clientRoles array.

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com

Mar 5, 2010 at 7:19 PM
Edited Mar 6, 2010 at 6:03 AM

Thank you, I think that would work in this instance.  Is there anyway of accessing NetSqlAzMan directly from Javascript as my task is to create a simple interface within the companies application where certain users can assign operations to tasks and tasks to roles and even create new ones so I will need some sort of a way to access NetSqlAzMan from javascript as this is going to be a java application.  At the moment I am just failing to see how accessible NetSqlAzMan is in java.  I would like to be able to do the following from java or be able to access the results of the following but controlled from java instead of code behind:

IAzManApplication application = storage.GetApplication("MyApplication");ItemType.Role);

As then I can access "Application" and Get and Set all the things I need using IAzManItem[], I would also need the storage level for this user group data too.  Sorry to be a pain but I have only been using this a few days and as usual my line manager wants it done yesterday.