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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataValidation from range on other sheet

Thread ID:

Created:

Updated:

Platform:

Replies:

106641 Jan 19,2013 04:00 PM UTC Jan 22,2013 10:21 AM UTC WinForms 3
loading
Tags: XlsIO
Matt Andreko
Asked On January 19, 2013 04:00 PM UTC

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 04:06 PM UTC

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 08:31 PM UTC

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 10:21 AM UTC

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.

Regards,
Sridhar.S

CONFIRMATION

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.

Warning Icon 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.Close Icon

;