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 error with DataRange

Thread ID:

Created:

Updated:

Platform:

Replies:

73046 Apr 17,2008 04:37 AM Apr 21,2008 09:19 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Nantoine
Asked On April 17, 2008 04:37 AM

Hi everyone,

I have a issue with the DataValidation property.
There is a ArgumentOutOfRangeException when the string is higher than 255 characters. So i want to set the possible values with a DataRange :

range = (IRange) sheet.Columns.GetValue(this.Column);

range.DataValidation.DataValidationRange = sheet.Range[1, 100, 32, 100];

It says that it's impossible to delete the element because it's not in the collection . . .

I tried with the FirstFormula too.

Thx


Yavanaarasi G [Syncfusion]
Replied On April 21, 2008 09:19 AM

Hi Kalkotue,

Thank you for your interest in Syncfusion products.

The "ArgumentOutOfRangeException" was thrown because the sum of all the strings greater than 256 characters. MS Excel has restriction of total 255 characters in the data validation formula, so summary strings length should be even less.

However you can use the following code snippets to set data validation for more [more than 256] characters by specifying the range address. But you can’t write more than 256 characters in the data validation formula. Please refer the following code snippet to achieve this.

[C#]

//Data validation to list the values in the first cell
IDataValidation validation = sheet.Range["A1"].DataValidation;
sheet.Range["A1"].Text = "Data validation list";
validation.FirstFormula = "$D$1:$D$8";
validation.AllowType = ExcelDataType.User;
validation.PromptBoxText = "Data Validation list";

Here is the sample for your reference:
http://websamples.syncfusion.com/samples/XlsIO.Web/6.2.0.39/73046/main.htm

Please take a look at the sample above and let me know if you have any other questions.

Regards,
G.Yavana



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.

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.

;