how to set submit button css class properties in custom table input edit web part?

Sonia Samimi asked on September 10, 2015 07:54

Hi guys, I've used custom table input edit web part to edit a custom table record in a page. when I push the submit button I've seen this error "Exception Details: System.NullReferenceException: Object reference not set to an instance of an object/ Line 270: customTableForm.BasicForm.SubmitButton.CssClass = SubmitButtonCssClass;" as I understand of this error "SubmitButtonCssClass" returns null so I want to fill it to handle this error. if you know how do I use this web part in edit mode please help me.

Recent Answers


Brenden Kehren answered on September 10, 2015 08:09

What version are you working with? Looks like the code you're talking about is working with v6 and v7 but v8 and higher. In v8, the syntax changed to customTableForm.SubmitButton.CssClass. There are versions out there for 6, 7, 8, and 8.1 (believe 8.1 will work with 8.2)

0 votesVote for this answer Mark as a Correct answer

Sonia Samimi answered on September 10, 2015 08:34

I'm working with V7 . You mean That the web part's code doesn't work with V7?

0 votesVote for this answer Mark as a Correct answer

Maarten van den Hooven answered on September 10, 2015 13:44

Hi Sonia, In Kentico v7 "customTableForm.BasicForm.SubmitButton.CssClass" is correct to set an CSS class to the submit button in the codebehind of your custom webpart code. So probably something else is going wrong. Do you have the possibility to debug the code. Probably the customTableForm is null.

0 votesVote for this answer Mark as a Correct answer

Jeroen Fürst answered on September 10, 2015 13:53

From my experience this can occur in certain page lifecycle events like load / init. Can you try to move the code to the prerender event? Good luck!

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 10, 2015 14:10

Sonia, I created that webpart and it's on the Marketplace. Have you set the other properties of the webpart for instance the custom table you're choosing to edit? The CssClass property can be null or empty so as Maarten suggested, there is something else going on or another property that you haven't set which is causing a null object.

1 votesVote for this answer Mark as a Correct answer

Sonia Samimi answered on September 12, 2015 08:16

Thank you guys, I will debug the code and notify you of the results.

0 votesVote for this answer Mark as a Correct answer

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