WynApse Home Page
Home    Blog    About    Contact       
Latest Article:


My Tags:
My Sponsors:






Lifetime Member:

tBlogger Fixes


While making a small Blog entry about Squeet and reading RSS via my email client, Barca, I ran over the 10-entry main-screen setting I have in tBlogger. The initial fix I had to put into the source, now reared it's head again, and I thought I'd show the simple fix.

In the file Blogs.ascx.cs, in the MainPage() method, this code is what's in the archive:



if(dv.Count > 0) // there are records
{
   numberOfRecords = dv.Count >= 10 ? 10 : dv.Count;

   DataRowView[] dvr = new DataRowView[10];

   for(int i = 0; i < numberOfRecords; i++)
   {
      dvr[i] = dv[i];
   }

   rpBlog.DataSource = dvr;
   rpBlog.DataBind();
}

If there are less than 10 entries, creating a DataRowView with 10 entries will definitely be a problem.
This was the problem originally discussed at SourceForge. The solution there carried me quite well until I rolled over the 10-entry limit. I apparently had not looked at the code close enough to see the next problem.
To avoid overrunning the DataRowView, the 'new' line needs to be:



DataRowView[] dvr = new DataRowView[numberOfRecords];

Not a huge revelation, but if anyone is using tBlogger, there's a bit of code to go through to find simple fixes like this.
Copyright © 2006-2017, WynApse