I have created a custom grid on our dashboard and able to get he button to show up am unable to get the buttons to show up on the data grid in my dashboard. Any one able to help me get this working on the native grid.
Thank you.
// **************************************************
// Custom code for MainController
// Created: 4/23/2021 11:21:27 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Infragistics.Win.UltraWinGrid;
using System.Collections.Generic;
using Ice.Core;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
EpiUltraGrid ugQuoteHeader;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.ClearFilters.Click += new System.EventHandler(this.ClearFilters_Click);
this.btnCustomerFilter.Click += new System.EventHandler(this.btnCustomerFilter_Click);
this.ugQuoteHeader =(EpiUltraGrid)csm.GetNativeControlReference("598c6b70-6cba-4b4a-9755-243fcd8e2925");
this.ugQuoteHeader.DisplayLayout.Bands[0].Columns["Calculated_Button"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
this.ugQuoteHeader.DisplayLayout.Bands[0].Columns["Calculated_Button"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
this.ugQuoteHeader.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ugQuoteHeader_ClickCellButton);
this.ugQuoteHeaders.DisplayLayout.Bands[0].Columns.Add("HubSpot");
this.ugQuoteHeaders.DisplayLayout.Bands[0].Columns["HubSpot"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
this.ugQuoteHeaders.DisplayLayout.Bands[0].Columns["HubSpot"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
this.ugQuoteHeaders.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ugQuoteHeaders_ClickCellButton);
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.ClearFilters.Click -= new System.EventHandler(this.ClearFilters_Click);
this.btnCustomerFilter.Click -= new System.EventHandler(this.btnCustomerFilter_Click);
this.ugQuoteHeaders.ClickCellButton -= new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ugQuoteHeaders_ClickCellButton);
this.ugQuoteHeader.ClickCellButton -= new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ugQuoteHeader_ClickCellButton);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void ClearFilters_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
Ice.Lib.Framework.EpiBasePanel pnl = (Ice.Lib.Framework.EpiBasePanel)csm.GetNativeControlReference("9fc6a346-e062-4c54-a790-6e37882f4463");
EpiUltraCombo closedQuote = (EpiUltraCombo)csm.GetNativeControlReference("4b5ff17c-1d71-42df-9700-a3e4a997aa5b");
EpiUltraCombo hasPO = (EpiUltraCombo)csm.GetNativeControlReference("e693b2c2-81a3-414b-b64e-89ed0b1efc6e");
foreach (Control c in pnl.Controls)
{
if (c.GetType() == typeof(EpiTextBox))
c.Text = string.Empty;
if (c.GetType() == typeof(EpiNumericEditor))
{
((EpiNumericEditor)c).Value = null;
}
if (c.GetType() == typeof(EpiCombo))
{
c.Text = string.Empty;
}
if (c.GetType() == typeof(EpiDateTimeEditor))
{
c.Text = string.Empty;
}
if (c.GetType() == typeof(EpiTimeEditor))
{
c.Text = string.Empty;
}
}
closedQuote.Text = string.Empty;
hasPO.Text = string.Empty;
}
private void btnCustomerFilter_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
SearchOnCustomerAdapterShowDialog();
}
private void SearchOnCustomerAdapterShowDialog()
{
// Wizard Generated Search Method
// You will need to call this method from another method in custom code
// For example, [Form]_Load or [Button]_Click
EpiTextBox customer;
customer = (EpiTextBox)csm.GetNativeControlReference("9ed9ba42-1573-41ff-a6b0-e0b58cca8eaf");
bool recSelected;
string whereClause = string.Empty;
System.Data.DataSet dsCustomerAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "CustomerAdapter", out recSelected, true, whereClause);
if (recSelected)
{
System.Data.DataRow adapterRow = dsCustomerAdapter.Tables[0].Rows[0];
// Map Search Fields to Application Fields
EpiDataView edvV_QuoteTracking_1View = ((EpiDataView)(this.oTrans.EpiDataViews["V_QuoteTracking_1View"]));
System.Data.DataRow edvV_QuoteTracking_1ViewRow = edvV_QuoteTracking_1View.CurrentDataRow;
if ((edvV_QuoteTracking_1ViewRow != null))
{
edvV_QuoteTracking_1ViewRow.BeginEdit();
edvV_QuoteTracking_1ViewRow["Customer_CustID"] = adapterRow["CustID"];
edvV_QuoteTracking_1ViewRow.EndEdit();
}
System.Data.DataRow adapterRow1 = dsCustomerAdapter.Tables[0].Rows[0];
customer.Text = adapterRow1["CustID"].ToString();
}
}
private void ugQuoteHeaders_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs args)
{
// ** Place Event Handling Code Here **
string companyName = oTrans.CoreSession.CompanyName;
string instanceProd = "";
string instanceTest = "";
string instance = "";
string [] urlArr;
string url;
urlArr = new string[5];
foreach(var row in ugQuoteHeaders.Rows)
{
if(row.Activated)
{
if(companyName.ToLower().Contains("test"))
{
instanceTest = "20935426";
instance = instanceTest;
}
else
{
instanceProd = "532305";
instance = instanceProd;
}
urlArr[0] = "https://app.hubspot.com";
urlArr[1] = "/contacts/";
urlArr[2] = instance;
urlArr[3] = "/deal/";
urlArr[4] = row.Cells["QuoteHed_HSDealID_c"].Value.ToString();
url = string.Join ("",urlArr);
//MessageBox.Show(url,"test");
Process.Start(url);
MessageBox.Show(row.Cells["QuoteHed_HSDealID_c"].Value.ToString());
MessageBox.Show("Dont Touch Me There","EWWWWW");
}
}
}
private void ugQuoteHeader_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs args)
{
// ** Place Event Handling Code Here **
MessageBox.Show("Dont Touch Me There","EWWWWW");
}
}