/// <summary> /// Handles the DeleteCommand event of the DataGrid control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> void dgMapping_DeleteCommand(object source, DataGridCommandEventArgs e) { lip = (ListImportParameters)ViewState["lip"]; string mfName = e.CommandArgument.ToString(); lip.RemoveNewMetaField(mfName); lip.RemoveRuleByMetaField(mfName); ViewState["lip"] = lip; Session[_keyLIP] = lip; BindDG(); }
/// <summary> /// Handles the SelectedIndexChanged event of the ddi control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void ddi_SelectedIndexChanged(object sender, EventArgs e) { if (ViewState["lip"] != null) { lip = (ListImportParameters)ViewState["lip"]; DropDownList ddl = (DropDownList)sender; DataGridItem dgi = (DataGridItem)ddl.NamingContainer; DataGrid dg = (DataGrid)dgi.NamingContainer; FillDefaultValues(dg, dgi); string mf = dgi.Cells[0].Text; switch (ddl.SelectedValue) { case "-1": lip.RemoveRuleByMetaField(mf); break; case "0": MappingRule mr = lip.AssignDefaultValueRule(mf); MetaField field = lip.GetDestinationMetaField(mf); if (field.IsEnum) { DropDownList dd = (DropDownList)dgi.FindControl("ddColumn"); CHelper.SafeSelect(dd, mr.DefaultValue); } else { TextBox txt = (TextBox)dgi.FindControl("tbColumn"); if (txt != null) txt.Text = mr.DefaultValue; } Label lbl = (Label)dgi.FindControl("lblColumn"); if (lbl != null) lbl.Text = mr.DefaultValue; break; default: lip.AssignCopyValueRule(ddl.SelectedValue, mf); break; } ViewState["lip"] = lip; Session[_keyLIP] = lip; BindDG(); } }