ListView Problems


Author
Message
Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi All.

This should be dead simple - I have a BO called boAllPeople with a data access method called GetAllPeople():

public void GetAllPeople()

{

SqlCommand loCommand = new SqlCommand();

loCommand.CommandType = CommandType.StoredProcedure;

loCommand.CommandText = "prcListAllPeople";

this.FillDataTable(loCommand);

}

Here is the code in prcListAllPeople:

ALTER PROCEDURE [dbo].[prcListAllPeople]

AS

BEGIN TRY

DECLARE @RetVal INT

SET @RetVal = 1

SELECT first_nme, last_nme, contact_dtl, people_id

FROM dbo.vw_AllPeople

ORDER BY last_nme, First_nme

END TRY

BEGIN CATCH

/* Get the details of the error*/

EXEC prcLogError

SET @RetVal = -1

END CATCH

IF @RetVal < 0

BEGIN

DECLARE @ErrText VARCHAR(1000)

SET @ErrText = 'Unable to Retrieve People List'

RAISERROR( @ErrText, 16, 1 )

END

RETURN @RetVal

There are no records in my error_log table.

This is how my listview is configured

Columns collection has 3 columns: 1 for first name, last name and primary phone.

PopulationDataSource = boAllPeople.GetAllPeople()

Display fields are

{0} - last_nme

{1} - first_nme

{2} - contact_dtl

Tag is people_id

Columns are the same as what is in the columns collection and population type is formatted string.

PopulateOnFormLoad = FormLoad

I have verified that the view does have a record in it. However, when my form comes up, the list view contains the column headings in the first row where the single record in the view should be.

Can anyone tell me what I am doing wrong?

Thanks!

 


Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
If you are sure the BO has a record in it, you probably are not handling the listpopulating event of the listview - or not requerying it after filling the BO (this was a hard one for me to wrap my brain around)



Private Sub slvpdfs_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles slvPDFs.ListPopulating

e.Parameters(0).Value = Me.StaticPDFsBO1

e.Parameters(1).Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable

End Sub




After filling the BO, call the listview.requery() and that should do it.

Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi Charles

If you are sure the BO has a record in it, you probably are not handling the listpopulating event of the listview - or not requerying it after filling the BO (this was a hard one for me to wrap my brain around)

I set the ListView's PopulateOnLoad property to FormLoad. The documentation says that this automagically populates the list when the form loads. I have another ListView used in a different project set up exacrly the same way and it works fine. Just for grin and giggles, I tried substituting a ListBox - no joy - same behavior.

One of my problems is that ever since I upgraded to version 1.0.7.1, I can no longer step throught he framework source code, so I am having even bigger problems trying to figure out what is wrong. If I could get that problem resolved, I could probabaly figure this one out too Sad


Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
After filling the BO, call the listview.requery() and that should do it.

I changed the PopulateOnFormLoad property to Manual and added your code and still no joy. If I could just step through the framework code I know I would be able to figure this out w00t

Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
The part that confused me was realizing the listview is not bound to the bo currentview but rather has its own internal data store. So, if you load data in the BO, then yoiu need to requery the LV - and that means handling the listpopulating event which needs to know the BO and the method (usually cloning/copying from bo) for getting data from bo to LV.



Anyway, I'd check the listpopulating handler and the lv.requery()



(the lv for the code I posted has a PopulationDataSourceSetting = CopyDataFrom(Businesslayer,BusinessCloneDataType)



HTH



Hi to Andy. when you get time check out my thing under User Contributed samples re passing in datatable as a param to a sproc - I bet you and Andy will have some useful insights into that )

Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Anyway, I'd check the listpopulating handler and the lv.requery()

(the lv for the code I posted has a PopulationDataSourceSetting = CopyDataFrom(Businesslayer,BusinessCloneDataType)

HTH

As I said, I tried that already and still no joy Sad

Any ideas about what I need to do in order to step though the framewwwork code. I appear to have lost that ability after upgrading.

Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi Charles.

At least this time something new happened. I got an error:

ArgumentException
  Object of type 'TGIF.BusinessObject.boAllPeople' cannot be converted to type 'System.Data.DataTable'.

Source     : mscorlib

Stack Trace:
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at MicroFour.StrataFrame.UI.Windows.Forms.ListView.GetFilledBusinessObject(Object[] Parameters)

Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi Charles.

Thanks for trying to help me - I just fidured out what the peoblem was - it was the loose nut behind the keyboard having a senior moment. I can't even tell you what I did because it was so freaking stupid that I would be embarrassed to death Blush

Now if I could just figure out how to step through the framework code again all would be well Smile

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
To step through the framework code, simply open up the source code and build it in debug mode. The AfterBuild.bat should move these assemblies into the GAC for you (but you can double check if you do not see it in the Output window).



Next, get out of Visual Studio, go back in. You should now be able to step into the SF source. Let me know if that doesn't get you going. Smile
Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Next, get out of Visual Studio, go back in. You should now be able to step into the SF source. Let me know if that doesn't get you going.

Thanks. Yer a peach!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search