but doesn't have any attribute for code behind file, so if I want to execute some code using object model in Page_load method then I will have to create a custom form with code behind file as I need to get things from DB and am not so willing to use Javascript ?

2 Answers
2

You have to create your own custom ones and bind them to the list in your list template (or modify it through code).

If you for example navigate to "http://yourserver/Lists/YourListName/NewForm.aspx"; you can view the form. All it is, is a webpartpage with a ListFormWebPart on it. If you go to "http://yourserver/Lists/YourListName/NewForm.aspx?contents=1"; you can see the web parts on the page. Bear in mind that you should never edit the original files in the 12 hive. If you want to change them, make a copy of the original and provision the new one.

The NewForm.aspx in the 12 hive is only a template. It is provisioned in the database each time a new list is created.

Create an webpart with no front-end, overwrite CreateChildControls (or any other page event that you find suitable to your need but if you are unsure go with CreateChildControls) and write your logic inside it, add the webpart in the form opening the page in edit mode, but as suggested by @Grooverinthesouth dont edit the default one, make a copy of it