protected void btnSubmit_Click(object sender, EventArgs e) { var t = new Item(); var tc = new ItemController(); if (ItemId > 0) { t = tc.GetItem(ItemId); t.HelloText = txtName.Text.Trim(); } else { t = new Item() { HelloText = txtName.Text.Trim(), }; } if (t.TextId > 0) { tc.UpdateItem(t); } else { tc.CreateItem(t); } Response.Redirect(DotNetNuke.Common.Globals.NavigateURL()); }
protected void Page_Load(object sender, EventArgs e) { try { //Implement your edit logic for your module if (!Page.IsPostBack) { //get a list of users to assign the user to the Object //check if we have an ID passed in via a querystring parameter, if so, load that item to edit. //ItemId is defined in the ItemModuleBase.cs file if (ItemId > 0) { var tc = new ItemController(); var t = tc.GetItem(ItemId); if (t != null) { txtName.Text = t.HelloText; } } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }