locked
Filtering filters, field templates and grid RRS feed

  • Question

  • User1043796333 posted

    I am using the ListDetails of the global.asax file but I'm facing an estrange behavior<o:p></o:p>

    I have modified all the populate methods and my filters and custom field are filled ok. My criteria for filtering is simple and I split my database by using 2 different codes for 2 different companies <o:p></o:p>

    But when it comes that I have zero records in my grid for an entity in which I already have records for the other company the right grid shows the message: no records, which is ok, but the detailsview on the left side is filled with the data of the first record of that table even if it doesn't belong to that company code

    I haven’t been able to trace the method which fills data in the first place as to avoid showing incorrect data belonging to a different company code. It seems that there is an additional populate method that I couldn't find

    Friday, June 3, 2011 11:29 AM

Answers

  • User-330204900 posted

    I'm going to have a look to see if I have it done already I may have doen a sample in .Net 4 but I now mostly use my Hierachical cascade now and designe the DB accordingly.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 5, 2011 3:12 PM

All replies

  • User-330204900 posted

    the detailsview on the left side is filled with the data of the first record of that table even if it doesn't belong to that company code

    Have a look at the code behind of the ListDetails page see:

    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count == 0)
        {
            FormView1.ChangeMode(FormViewMode.Insert);
        }
    }

    What is supposed to happen here is if the Grid has no record then it should switch the form to Insert mode, you could check this in debug mode and maybe hide the form view depending on what you want.

     

    Friday, June 3, 2011 11:59 AM
  • User1043796333 posted

    the detailsview on the left side is filled with the data of the first record of that table even if it doesn't belong to that company code

    Have a look at the code behind of the ListDetails page see:

    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count == 0)
        {
            FormView1.ChangeMode(FormViewMode.Insert);
        }
    }

    What is supposed to happen here is if the Grid has no record then it should switch the form to Insert mode, you could check this in debug mode and maybe hide the form view depending on what you want. 

    It works for hidding but it doesn't work for practical purposes because then there isn't a way for adding records

    Friday, June 3, 2011 7:33 PM
  • User-330204900 posted

    Hi Topolov, I have just tested this in a vanila DD project and the FormView does switch to Insert mode when the filters return 0 rows, therefore I think there must be somthing you have changed to cause this issue.

    Saturday, June 4, 2011 7:13 AM
  • User1043796333 posted

    Before I start I must say that I'm quite comfortable using your solution in my project

    What I've done is using your DD_EF_CascadingFiltersAndFields solution as my zero ground. I coudln't make filters to work by adapting your code into mine but because it works ok in yours I migrated Cool to the functional one (yours)

    I've seen your solution is different from the standard one but it works fine; for example, you don't have an EntityTemplates folder. You also use DetailsView instead of FormView in ListDetails to mention a few different things

    In essence I've just changed until now all the PopulateListControl methods. What I've implemented is using a second parameter to do pre filtering, that's all I've done until now

    Saturday, June 4, 2011 11:45 AM
  • User1043796333 posted

    Ok

    Here's the thing: After inserting the first record the grid shows the data ok (prefiltered) but the left side detailsview shows the data belonging to the first record in the database table

    In other words, if I select from the grid the newly inserted record then everything's just fine but after the firts insertion the data displayed doesn't belong to the one shown in the grid

    Where is this first load made? In what program, in what method?

    Saturday, June 4, 2011 12:08 PM
  • User-330204900 posted

    Hi Topolov, if there is no EntityTemplate folder then that is an old .Net 3.5 project I will see if I can find a .Net 4 version for you.

    Sunday, June 5, 2011 5:22 AM
  • User1043796333 posted

    sjnaughton: Do you have it already made or is it gonna take you some time and effort to prepare it?

    Sunday, June 5, 2011 2:19 PM
  • User-330204900 posted

    I'm going to have a look to see if I have it done already I may have doen a sample in .Net 4 but I now mostly use my Hierachical cascade now and designe the DB accordingly.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 5, 2011 3:12 PM
  • User-330204900 posted

    Hi Topolov, I've had a look and I only have cascading fields at the moment I will have a look adn see what I can do.

    Sunday, June 5, 2011 3:41 PM