Correct Solution to the Problem of incorrect format of input strings in DevExpress Grid & quot;

Source: Internet
Author: User

When using the grid of the DEV control, dynamically create columns. If you clear a column with data (including input and empty again ), the system prompts "the format of the input string is incorrect" and finds some solutions to this problem on the Internet. Including the unofficial "huidu Control Network", the method is as follows:

Note: The premise is to set the ColumnEdit of this field to the following RepositoryItemTextEdit

The Code is as follows:

Private void RepositoryItemTextEdit_ParseEditValue (object sender, DevExpress. XtraEditors. Controls. ConvertEditValueEventArgs e)
{
TextEdit edit = (TextEdit) sender;
If (edit. Text = string. Empty)
E. Value = null;
} Another more complex piece of code that another friend gave me was included. I tried both of the two pieces of code to clear them. However, if you click this field, the input box is empty. Although you do not enter any value, the focus is removed and the original data is still in progress. To clear a value, you must enter a value and clear it. This operation is a bit difficult. I don't know why this is the case. Is it because DEV is not the case. I use 9.1.3. The problem had to be solved, so I had to find out what I could do with the following code:

Private void repositoryItemTextEdit1_ParseEditValue (object sender, DevExpress. XtraEditors. Controls. ConvertEditValueEventArgs e)
{
Object obj = e. Value;
If (obj = null | obj. ToString () = string. Empty)
E. Value = null;
}

For more information, see. I have not analyzed the principle.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.