creating a new textfields in blogengine(add_entry.aspx.cs)

Topics: ASP.NET 2.0
Nov 26, 2011 at 2:18 PM

i am trying to create extra items in blog engine 2.5 but it always give exceptions an error .

what i am doing is creating textfields in admin/posts/add_entry.aspx.cs where i like to see what i fill of information in  themes/standard/postview.ascx. .

please can anybody help me because i sit in this problem for long time ago and i couldnot fix fit .

i feel i miss something but i donot what ?!

Nov 26, 2011 at 2:40 PM
Edited Dec 2, 2013 at 1:28 AM
Check out this post: How to Add a Custom Field to a Post in BlogEngine.Net



New Link:
http://blog.bloggersonline.com/post/How-to-Add-a-Custom-Field-to-a-Post-in-BlogEngineNet
Nov 26, 2011 at 2:48 PM

Hi ,

i have tried to do these steps:

Post.cs  <--- BlogEngineDotSlave  Business Logic

Posts.cs  <---   In the Providers --> XML Provider

ajaxhelper.aspx.cs  <--  Admin

Globalresource file  <-- Root

EditPost.aspx     <----    Admin-->Posts

EditPost.aspx.cs  <----    Admin-->Posts

but i could not find Editpost.aspx and Editpost.aspx.cs and globalresources file is a folder or a file (because i couldnot find it too)

and one more question  how i should rebuild than recompile my dll file ?

because now i get two errors  from blog engine

Error 53 'BlogEngine.Core.Page' does not contain a definition for 'Projectnumber' and no extension method 'Projectnumber' accepting a first argument of type 'BlogEngine.Core.Page' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\sariedin\Mijn documenten\Downloads\BlogEngine.NET 2.5 (source)\BlogEngine\BlogEngine.NET\admin\AjaxHelper.aspx.cs 350 22 C:\...\BlogEngine.NET\


Error 54 'System.Xml.XmlWriter' does not contain a definition for 'writeElementString' and no extension method 'writeElementString' accepting a first argument of type 'System.Xml.XmlWriter' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\sariedin\Mijn documenten\Downloads\BlogEngine.NET 2.5 (source)\BlogEngine\DotNetSlave.BusinessLogic\Providers\XmlProvider\Posts.cs 110 24 BlogEngine.Core
 

i hope you can help me  :-)

thanks in advanced

Nov 27, 2011 at 7:23 AM
Edited Dec 2, 2013 at 1:29 AM
Hello blogcode, I created a very detailed post on how to Add a custom field to a Post: How to Add a Custom Field to a Post in BlogEngine.Net The post above should help you out with everything you need to know :) Here are the correct file names and locations: Files that needs to be Edited: 1. DotNetSlave.BusinessLogic –> Post.cs 2. DotNetSlave.BusinessLogic –> XmlProvider –> Posts.cs 3. BlogEngine.Net –> Admin –> AjaxHelper.aspx.cs 4. BlogEngine.Net –> Admin –>  Posts –> Add_entry.aspx 5. BlogEngine.Net –> Admin –> Posts –> Add_entry.aspx.cs 6. BlogEngine.Net –> App_GlobalResources –> labels 7. BlogEngine.Net –> App_Data –> posts –> post.xml files Total of 7 Files that needs to be edited   Let me know what you think of the post? Thanks, Brian Davis


New Link:
http://blog.bloggersonline.com/post/How-to-Add-a-Custom-Field-to-a-Post-in-BlogEngineNet
Nov 27, 2011 at 1:08 PM
Edited Nov 27, 2011 at 1:19 PM

 i have done all 7 steps but when i am adding my post with new text field that called (project number) i get this exception

var title = document.getElementById('ctl00_cphAdmin_txtTitle').value;
 var projectnumber = document.getElementById('txtProjectnumber.ClientID').value;

and it is Runtime-fout Microsoft JScript: Object vereist

mmm i donot know what i done wrong ...one more thing my blog engine file doesnot has folder called regexrewriter
i hope u can help me

Coordinator
Nov 28, 2011 at 12:47 AM

I believe that one line of JavaScript is missing <%=  %> and should be:

var projectnumber = document.getElementById('<%= txtProjectnumber.ClientID %>').value;
Nov 29, 2011 at 11:08 AM
Edited Nov 29, 2011 at 11:55 AM

it works :-) thanks all for your hulps :-)

but know i have another problem ...

when i fill all my post in one time i get exception over  this part an in tags  even my new field (projectnumber) isnot in and even i write it in i still get it  and when i add my post 2 times it works fine for example :i enetr title, content, category then i save it then next time i open edit and add projectnumber , auther, tags.then save it and it works ! can anyone hulp me  

public void RaiseCallbackEvent(string eventArgument) if (eventArgument.StartsWith("_autosave" )) var fields = eventArgument.Replace("_autosave", string .Empty).Split( new[] { ";|;" }, StringSplitOptions .None);

  Session["content" ] = fields[0];

 Session["title" ] = fields[1];

  Session[

"description" ] = fields[2];

Session["slug" ] = fields[3];

 Session["tags" ] = fields[4];  

 

 

 

 

 

 

 

 

 

 

 

 

Nov 30, 2011 at 8:44 AM

You need to add your custom field in there too like this:

 

 Session["projectnumber" ] = fields[5];

This is step:

3. BlogEngine.Net –> Admin –> AjaxHelper.aspx.cs


Nov 30, 2011 at 1:50 PM

Hi,

i have added at it still give me exception  ( index was outside the bounds of the array.) and for the tag session ..

 

Dec 1, 2013 at 1:59 PM
Dec 2, 2013 at 1:31 AM
aymancodeplex wrote:
hi
the link not working
http://programmingsolution.net/post/Add-Custom-Field-to-Post-Part1.aspx

any help ?
New Link now is:
http://blog.bloggersonline.com/post/How-to-Add-a-Custom-Field-to-a-Post-in-BlogEngineNet


The Post is outdated but still applies to BE 2.5 will update post in the future to reflex current changes and methods to use.

If you need any other help or have questions after reading post please let us know here :)

Have a great day!

Brian Davis

http://kbdavis07.info
Dec 2, 2013 at 4:57 AM
Thank you very much