Prompt for Save when changes made in UDashboard when Refresh Tool Clicked

Thanks so much Chris! I really appreciate you taking the time to spell it out for me as I am a C# noob. Slowly getting better though!

This looks like it’s exactly what I am looking for and I will let you guys know how it goes when I implement it. :slight_smile:

1 Like

Sadly this code doesn’t seem to be working in my Dashboard. Wondering if it is another side effect of being a UBAQ?

Looks like it just isn’t recognizing the variable as the MessageBox pops up everytime.

what is your true condition?

Some Extra Reading:

This is what I’ve got right now, I took my previous code which was working, and slotted it into the format you provided. The messagebox at the end was just for testing purposes, instead of it prompting to save every time I tested it.

	private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{	EpiUltraGrid myGrid; 		
		myGrid = (EpiUltraGrid)csm.GetNativeControlReference("5925c581-5da3-4aee-8fc1-66ea887789d1");
		
	if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
			hasChange = true;
			break;	
		}
		
		if (hasChange);
		MessageBox.Show("Did it Work?"); 
			
		
		}
	}	

}

Do either this:


if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
			hasChange = true;
			break;	
		}
		
		
			
		
		}

                if (hasChange)
		MessageBox.Show("Did it Work?"); 
	}	

}

or do this:

if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
                        MessageBox.Show("Did it Work?"); 
			break;	
		}
				
		}

                
		
	}	

}

Also, notice the ;. it ends the statement, this means it doesnt evaluate to show the messagebox, it simply shows it every time

Thank you for the options Chris :slight_smile:

Unfortunately, I’ve tried both and the messagebox still shows everytime. I tried to fiddle with both instances of Code to see if I could troubleshoot it, but with no success.

private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{	EpiUltraGrid myGrid; 		
		myGrid = (EpiUltraGrid)csm.GetNativeControlReference("5925c581-5da3-4aee-8fc1-66ea887789d1");
	
if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
			hasChange = true;
			break;	
		}
		
		
			
		
		}

                if (hasChange)
		MessageBox.Show("Did it Work?"); 
	}	

}

Shea, not sure if you got this working or not but I have you gotten rid of the semicolon at the end of this line? That would cause the bool to change to true every time which would then show your message box.

JAKOB! thank you! I knew it was going to be something so small that I was missing.

That did the trick and it is working perfectly now.

Thank you for everyone’s help :slight_smile:

1 Like