We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

DataValidation from range on other sheet

Thread ID:





106641 Jan 19,2013 11:00 AM Jan 22,2013 05:21 AM Windows Forms 3
Tags: XlsIO
Matt Andreko
Asked On January 19, 2013 11:00 AM

I'm trying to add Data Validation to a cell in a worksheet. However, that Data Validation is a formula that references another sheet in the workbook.

In Excel, the Data Validation looks like this:

Essentially it's:
Allow: List
Source: =Other_Worksheet!$A$22:$A$37

I can't seem to make this work in XlsIO.  Is it not supported?  I don't want to hard-code the list of values in my application if I can avoid it.

The code I'm doing so far:

var assessmentPhaseValidation = vulnsTab.Range["A1:A" + (row - 1)].DataValidation;

assessmentPhaseValidation.AllowType = ExcelDataType.User;

assessmentPhaseValidation.PromptBoxText = "Data Validation List";

assessmentPhaseValidation.IsPromptBoxVisible = true;

assessmentPhaseValidation.ShowPromptBox = true;

However, when I do that, it strips off the other sheet name, making the validation in the current sheet (which doesn't work).

Matt Andreko
Replied On January 19, 2013 11:06 AM

Sorry, I missed a line.  Pretend that this line was also in the above source:

assessmentPhaseValidation.FirstFormula = "=Criticality_Overview!$A$22:$A$37";

Matt Andreko
Replied On January 21, 2013 03:31 PM

For anyone else that has issues, I made it work like this:

var assessmentPhaseValidation = vulnsTab.Columns[0].DataValidation;

 assessmentPhaseValidation.DataRange = vulnsTab.Workbook.Worksheets["Criticality_Overview"].Range["A22:A37"];

In addition to that, I also had to have this enabled on the workbook:

workbook.Allow3DRangesInDataValidation = true;

Sridhar [Syncfusion]
Replied On January 22, 2013 05:21 AM

Hi Matt,

Thank you for using Syncfusion products.

We are glad to know the above reported issue is resolved at your end.

If you still face the issue, please get back to us with issue reproducing sample with excel template to proceed further.

Please let me know if you require any further clarifications.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.