Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / Converting cell input to upper case

Converting cell input to upper case

New Discussion
Gary Hogle
Gary Hogle asked on Jun 26, 2015 8:18 AM

I have a WebHierarchicalDataGrid configured to allow me to do inserts and updates. I have this working fine. What I can’t seem to figure out is how I can convert cell input, on an insert, to uppercase before its written to the database.

Sign In to post a reply

Replies

  • 0
    Zdravko Kolev
    Zdravko Kolev answered on Jun 16, 2015 9:09 AM

    Hello,

    Thank you for your question,

    About your question, you can use ToUpper() method before the actual insert, or you can change your Insert statement to use UPPER (link).

    Other useful links:

    http://stackoverflow.com/questions/11357586/changing-sql-server-table-entries-into-uppercaseinput-by-vb-net-in-c

    http://stackoverflow.com/questions/11338437/store-the-text-entered-by-the-user-as-it-is-in-the-database-c-sharp

    • 0
      Gary Hogle
      Gary Hogle answered on Jun 16, 2015 1:40 PM

      Zdravko,

      Thank you for your quick response! I didn't consider changing the insert sql statement to use UPPER on my sqldatasource. For the insert that solution works perfectly. I have to ensure all input goes to upper case when it gets written to the database because a seperate linux process will be consuming the database information and its process code is case sensitive and expects upper case. This is not a process I control.

      However, I am faced with the same issue when a row update occurs (cell input must be forced to upper case). So, I changed the sql update statement in the same fashion as for the insert. That takes care of getting the value to upper case in the database table, but the input in the grid cell remains lower case until I perform a rebind on the grid after which the upper case value is displayed. Is the rebind a necessity in this case?

      Originally, I was looking for a way to perform the Insert case conversion in the rowAdding event on the client or server side ( I haver tried both ). In the server side RowAdding event everything seems to be readonly that I need to access. On the client side RowAdding event, I set up, I can alter the value of the grid cell, using set_value, but when I press the enter key to commit the new value, I see the conversion change momentarily, on the add row, but it then appears as the original input value, in a new grid row, after a rebind is called. I suspect this has something to do with the cell not being in edit mode when I am trying to alter it in the rowAdding event.

       

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Jun 22, 2015 12:14 PM

        Hello hogleg,

        Thank you for the detailed explanation.

        In order not to perform any server changes you can just handle ExitedEditMode of both CellEditing and RowAdding, and to use 'toUpperCase()' in order to change the value to be with upper letters.

        Code snippet:

        <script type="text/javascript" id="igClientScript1">
            function WebDataGrid1_CellEditing_ExitedEditMode(sender, eventArgs) {
                eventArgs.getCell().set_value(eventArgs.getCell().get_text().toUpperCase())
            }
        </script>
      • 0
        Gary Hogle
        Gary Hogle answered on Jun 25, 2015 3:52 PM

        Thank you for your response. This was helpful information and what I was after!!!

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Jun 26, 2015 8:18 AM

        Hello,

        I am glad that I've managed to help you!

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Gary Hogle
Favorites
0
Replies
5
Created On
Jun 26, 2015
Last Post
11 years, 2 months ago

Suggested Discussions

Created by

Created on

Jun 26, 2015 8:18 AM

Last activity on

Feb 19, 2026 2:06 PM