 |
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
 | This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

October 27th, 2009, 02:24 PM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
|
|
EOList Method not found
This has me scratching my head because I did the exact same thing in another project and it worked fine with no issues. Hopefully someone can see what I am over looking.
I am wanting to sort my cgv by a particular parameter. This is exactly what I did in the other project that works.
- Created Stored Proc SelectByID
- Dragged this SP onto the table in ORM
- Created my Select statement in the Data class
Code:
publicList<XData> SelectByXId(int XId)
{
using (DataContext db = newDataContext(DBHelper.GetConnectionString()))
{
return db.SelectByXId(XId).ToList();
}
}
- Add public method to my EOList
Code:
publicvoid LoadByXId(int XId)
{
LoadFromList(newXData().SelectXId(XId));
}
- On my page with cgv I rig it to the Loadmethod
Code:
cgv.ListClassName = typeof(XEOList).AssemblyQualifiedName;
cgv.LoadMethodName = "LoadXId";
cgv.LoadMethodParameters.Add(XId.value);
Code compiles fine. When the page that contains the cgv tries to render it states that the Method LoadXId can not be found...
I have cleaned the solution and ensured that the, DAL, BLL, and UI all have the same libs and this still is happening. This worked in my other project, following the same procedures but no dice. Any ideas?
|
|

October 27th, 2009, 02:52 PM
|
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Something like this happened to me ...
By chance, is the name of the UI Webform the same as the BLL Class name (ListClassName)?
So in your case, is the form XEOList.aspx ? If so, change it.
Ronnie
|
|

October 27th, 2009, 03:03 PM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
|
|
Quote:
Originally Posted by kalel_4444
Something like this happened to me ...
By chance, is the name of the UI Webform the same as the BLL Class name (ListClassName)?
So in your case, is the form XEOList.aspx ? If so, change it.
Ronnie
|
Ronnie,
Not in this case, I name my DAL objects and BLL objects after the db tables they refer to and the forms are named accordinly to what information is being gathered or displayed. In this case my DAL is MRTrauma, BLL is MRTraumaEO and form with cgv is Traumas.aspx.
This really has me  I could see if it never worked but I pulled this from working code...makes it more frustrating.
|
|

October 27th, 2009, 03:08 PM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
|
|
Just to add, the only method that it will take is Load which is the general select all method created by the Code Generator. Stange indeed...
|
|

October 27th, 2009, 03:25 PM
|
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Are you passing the xId param when you goto the page.?
Otherwise, it's trying to load LoadByXid() not LoadByXid(xId).
If this isn't it, post the exact error.
|
|

October 27th, 2009, 04:51 PM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
|
|
The error happens in CustomGridView.cs
In the BindGridView methhod on this line
Code:
objectType.InvokeMember(LoadMethodName, BindingFlags.InvokeMethod, null, listObject, _methodParameters.ToArray());
The Error is as follows.
Method 'V2.PaidTimeOffBLL.MRTraumaEOList.LoadByReportId' not found.
What this says to me is that it didnt find the method, although it is there. It finds the Load method just fine, but none of the methods that I created. Initially I thought ok, let me rebuild the DAL and BLL and put those dll's in the UI, but still no dice. The debugger says that this error was thrown by mscorlib.dll, which I am sure there is a dirty hack to resolve it but I am a clean kinda guy unless I really need to get dirty. 
|
|

October 27th, 2009, 09:02 PM
|
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
So are you passing the param value to XId.value?
If you are, then confirm that XId.value is an int.
|
|
The Following User Says Thank You to kalel_4444 For This Useful Post:
|
|
|

October 28th, 2009, 11:10 AM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
|
|
Ronnie,
Good call, It didnt sink in what you said yesterday about the Param until I looked again this morning, I just wasnt handeling it properly. This is what I modified and got it working.
Initially:
Code:
Label1.Text = GetDecryptedValue("id");
cgvMorningReports.LoadMethodName = "LoadByReportId";
cgvMorningReports.LoadMethodParameters.Add(
Convert.ToInt32(Label1.Text)
);
This was causing the Method not found error
Modified:
Code:
Label1.Text = GetDecryptedValue("id");
int reportIdParam = Convert.ToInt32(Label1.Text);
cgvMorningReports.LoadMethodName = "LoadByReportId";
cgvMorningReports.LoadMethodParameters.Add(reportIdParam);
This works, but I would have expected the previous to work. So now I am thinking that the LoadMethodParameters.Add cant handle methods only values.
So help me understand something just for my knowledge, I would have expected the compiler to state that the Param wasnt in the proper format, instead of stating that it cant find the Method, that completely threw me off.
Thanks
|
|

October 28th, 2009, 02:53 PM
|
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Z,
Your initial implementation seemed like it should have worked, so I had to test it:
Code:
Label lbl = new Label();
lbl.Text = "1";
grdRequests.ListClassName = typeof(RequestList).AssemblyQualifiedName;
grdRequests.LoadMethodName = "LoadByUserId";
grdRequests.LoadMethodParameters.Add(Convert.ToInt32(lbl.Text));
This worked for me..!!! So I'm not sure why it wasn't working for you. ?????
Here are my thoughts:
For whatever reason, your conversion of string to int didn't take.
I know that if you pass an empty string value as a param value it will throw the 'method not found' error.
I'm assuming that an empty value ("") doesn't execute LoadMethodParameters.Add, and therefore doesn't include a parameter to the LoadMethod, and then tries to access LoadByReportId(), instead of LoadByReportId(int id).
Thats why you get an error telling you that there is no method LoadByReportId(), because there isn't...
If you want, you can add logic in the CustomGrid that checks the param value and if ("") do something.
I prefer to check the value after its assigned from the GetDecryptedValue method and check if null.
Good luck,
Ronnie
|
|

October 28th, 2009, 03:36 PM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
|
|
I dunno bro...im just glad that it is working. I will have to chunk this up to "one of those things" if you know what I mean.
The only other thing I can think of is that the error was occuring in mscorlib.dll. This Dev box hasnt been upgraded to any of the SPs for VS so I would have to say it could be reasons X-Z as to why VS wigged out for a moment. Technically I really didnt change anything besides issuing the value to a variable.
I have come across some strange stuff while coding in VS, the fix could have been closing VS and reopening it for all I know. As you also observed what I initially had should have worked. Anyway thanks for the explination, that really makes sense. I have always struggled with compile errors. I would have expected the compiler to throw an error that stated the param was not in the correct format or the Method LoadByReportId(int reportId) is not an overloaded method and expects int? reportId.
However going forward I know what to look for if it ever comes up again. Thanks
Last edited by ZeroFactorial; October 28th, 2009 at 03:39 PM..
|
|
 |