BugNET

Open source issue tracking & project management

Forums

HomeHomeDevelopment and...Development and...General Develop...General Develop...Implementing custom cross-project search - Problems with ctlDisplayIssues viewstate?Implementing custom cross-project search - Problems with ctlDisplayIssues viewstate?
Previous
 
Next
New Post
7/9/2010 9:00 AM
 
Hi there.

I'm implementing a BugNet deployment for an existing bug datasource.  I've migrated all the data over, added all the appropriate custom fields, re-generated the users etc but since we run 20+ projects concurrently we need a cross-project search.  I implemented the basics of the front and back end, and had planned on using ctlDisplayIssues for displaying the output.

I have a valid List<Issue> being generated from the search, I bind it to ctlDisplayIssues and they display fine but you can't change pages or page size in the control and if I re-run the same search I get a "The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request." error.

I've tried looking at the controls code but I can't really pin it down (I'm not a web developer) but it does deal with ProjectIds for setting up the drop down lists for configuring the gridview.  If I comment these out I don't get the error anymore but I still can't page.

Is there anything jumping out that I'm blatantly doing wrong?

As an aside, I also read that a search function is being implemented for the next release.  Is there a date set for that yet?

Many thanks
Andy
 
New Post
7/12/2010 3:17 AM
 
Just to clarify, when I run the search it returns the first page of results as it should, and the correct number of results are contained in the List<Issue>.

Oh, and the List<Issue> is created using

TExecuteReaderCmd<Issue>(sqlCmd, TGenerateIssueListFromReader<Issue>, ref issueList);

However when I hit the 'next' arrow the page looks to postback but when the page loads the gridview still displays the first page of results.

 
New Post
7/12/2010 6:09 AM
 
Make sure you implement the IssuesRebind event of the DisplayIssuesControl.  This is called after each postback to rebind the data to the control.

    protected void IssuesRebind(Object s, EventArgs e)
    {
      BindIssues();
    }

Davin Dubeau

follow us on twitter facebook users group google plus
 
New Post
7/12/2010 6:28 AM
 
Hah! :D Great minds think alike. That's exactly where the problem was.

After pulling my hair out for a while I realised that

1) The controls datasource is lost inbetween requests, meaning it must be re-pulling data
2) Stepping through the code for returning a normal set of issues didn't fail the 'if (RebindCommand != null)' condition in DisplayIssues.ascx.cs, whereas mine always did.

That lead me to find the code below,

private void InitializeComponent()
{
  this.ctlDisplayIssues.RebindCommand += new System.EventHandler(IssuesRebind);
}
 
override protected void OnInit(EventArgs e)
{
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
}
 
void IssuesRebind(Object s, EventArgs e)
{
    ExecuteSearch();
}


when I copied it over to my search page, everything worked immediately. :D

Many thanks for the response, you were bang on the money. :)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...General Develop...General Develop...Implementing custom cross-project search - Problems with ctlDisplayIssues viewstate?Implementing custom cross-project search - Problems with ctlDisplayIssues viewstate?


Forum Policy

These Discussion Forums are dedicated to the discussion of the BugNET issue tracker.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:
1. No Advertising.
2. No Flaming or Trolling.
3. No Profanity, Racism, or Prejudice.
4. Site Moderators have the final word on approving/removing a thread or post or comment.
5. English language posting only, please.