Is there a way to make a current SmartObject the datasource for a custom control?
I've already completed this now. I wanted to create a table that has a checkbox in the first row to select multiple rows without having to use control key.
Hello There,
Could you please share the information and sample code with me, if you have already implemented a custom control with SmartObject as the datasource.
Thanks in advance.
Regards,
Sunil
First make sure you have the references to at least the following:
SourceCode.EnvironmentSettings.Client
SourceCode.Forms.Client
SourceCode.SmartObjects.Client
SourceCode.HostClientAPI
SourceCode.Framework
Then from within your Control Code use something like:
//Use this helper method to create the connection to the Smart Object Client directly from Control Code (either in a handler or the control class itself)
var x = SourceCode.Forms.Controls.Web.SDK.Utilities.ConnectionClass.GetSmartObjectClient();
try
{
//Provide name of the Smart Object
SmartObject smartObject = x.GetSmartObject("Workflow_Comment");
// specify which method will be called
smartObject.MethodToExecute = "AddComment";
// specify input parameters for the method
smartObject.Properties["ProcessInstanceID"].Value = procInst.ToString();
smartObject.Properties["Comment"].Value = context.Request["comment"];
//Then execut the method (note there are also list method etc.)
x.ExecuteScalar(smartObject);
}
finally
{
//BE SURE TO CLOSE AND DISPOSE!!!!
x.Connection.Close();
x.Connection.Dispose();
}
You can also call the method below to return a data table:
// Execute to return data table
dt = x.ExecuteListDataTable(smartObject);
Good luck!
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.