gets bizform column item value into frontend

SSO Gagas Imaji asked on March 2, 2016 20:02

Hi, somebody help me pliiis!!

i want to display data from existing bizform into a page. I was trying for create some code and reading a references from an article, but there is still no result.

I have code as follows:

public int GetRecordId() { string bizTable = "bizTable"; string siteName1 = "siteName1"; // Given the Code Name of the BizForm and the current site, get the BizForm object. var bizFormInfo = BizFormInfoProvider.GetBizFormInfo(bizTable, siteName1);

    if (bizFormInfo != null)
    {
        var dataClassInfo = DataClassInfoProvider.GetDataClass(bizFormInfo.FormClassID);

        if (dataClassInfo != null)
        {
            // Using the built in Select query, get the record we're looking for.
            var connection = ConnectionHelper.GetConnection();

            var dataSet = connection.ExecuteQuery(dataClassInfo.ClassName + ".selectall", null, null, null);

            // Note the use of Kentico's aptly named DataHelper class.
            if (!DataHelper.DataSourceIsEmpty(dataSet) && dataSet.Tables[0].Rows.Count == 1)
            {
                return ValidationHelper.GetInteger(dataSet.Tables[0].Rows[0][0], 0);

            }
        }
    }

    // If we get here, we didn't find a valid record.
    // If we get here you should probably do one of the following:
    //   Redirect to the "new record" page
    //   Redirect to an error page
    //   Or throw an exception
    return 0;
}

Thanks for any kind respons

Recent Answers


Roman Hutnyk answered on March 2, 2016 20:15

I'd use custom query with some viewer web part, so no need to write your custom code.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.