Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1620
FromKey(Column): Upgrade "UltraGridColumn" to "GridField"
posted

I am converting Infragistics 2010 v2 CLR3.5 to Infragistics 2014 v2 using 4.5 CLR using Visual Studio 2013 Professional

Update 4. I am getting following error while building the project. Please reply immediately..........

Error: Cannot convert ControlDataField to GridField

Code is pasted below for your reference:

private void GridFindReplace(string column, string searchStr, string caseSensitive, string replaceTxt, string btnAction)
        {
            int index = contentTab.SelectedIndex + 1;
            string alertMsg = "";
            WebDataGrid uGrid = (WebDataGrid)contentTab.Tabs[index - 1].FindControl("grid_" + index);
            int rwCnt = uGrid.Rows.Count;
            int checkCol = column.IndexOf(".");
            if (checkCol > 0)
            {
                column = column.Substring(checkCol + 1, column.Length - checkCol - 1);
            }
            GridField gCol = uGrid.Columns.FromKey(column); //Used "GridField" instead of "UltraGridColumn"
            int chrLen = searchStr.Length;
            string fndExp;
            Regex fndRexp;
            bool flgReplace = false;
            int cntModified = 0;
            bool flgNotFound = true;
  • 20255
    Suggested Answer
    Offline posted

    Hello,

    This is because FromKey is returning ControlDataField type and not GridField. If you want to het a column by column key, you can pass it directly to the columns collection. You can get the column from Columns collection by index and column key, so you can use statement like this:

    GridField col = WebDataGrid1.Columns["SomeColumnKey"];