There are tutorials that describe the process of creating and editing smartobject instances using asp.net and the sqldatasource component. These tutorials are easy to get going and demonstrate k2 interaction in a simple manner, but they are not an example of how to interact with smart objects via code.
I would like a straightforward example of how to create and edit a smartobject using code. You can assume the following:
- A smartobject of type "Employee" has already been defined and successfully published to the k2 development server.
- An ASP.NET page has been created and some input fields and a save button have been added.
I'm looking for something vaguely like this pseudocode:
private void SaveButton_Click(object sender, EventArgs e)
{
Connection con = new Connection("k2devserver");
SmartObject smartObj = new SmartObject(con, "Employee")
smartObj.Properties["FirstName"].Value = FirstNameTextBox.Text;
smartObj.Save();
}
I expect that the above pseudocode will demonstrate how limited my understanding of the k2 api is, but hopefully it illuminates the sort of thing I am trying to do.
Thanks.