View Complete Post
I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!
I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.
On the masterpage, I have the following code:
Public Overridable ReadOnly Property SearchRes()
Private Sub DoSearch()
'some code to get a linq result
If res.Any Then
_res = res
LabelNoRes.Visible = True
On the SearchResults.aspx page I have this code.
Dim m As pxSite = CType(Page.Master, MasterPage)
If m.SearchRes IsNot Nothing Then
Label1.Text = "Results found = " & m.SearchRes.Count
m.searchRes is always nothing.
What am I doing wrong here?
I'm not sure how to structure the code for this but what I want to do is be able to add data to a database, and once this has completed successfully, then email the user to say the details have been added successfully to the database.
I need to:
1. Check that the relevant data has been added into the database then
2. Email the details of the relevant data when completed.
Thanks in advance for your help,
I have never tried a group by with linq, now I do and I'm stuck.
I try to convert this sql statement to its linq counterpart :
SELECT COUNT(tb_Mailer_Smses.Id) AS [cnt], tb_Mailer_mailing.Id As [Id]
,SUM( CASE WHEN tb_Mailer_smses.DLRStatus = 200 THEN 1 ELSE 0 END) As [Delivered]
,SUM(CASE WHEN DLRStatus BETWEEN 300 AND 499 THEN 1 WHEN DLRStatus BETWEEN 800 AND 899 THEN 1 END) AS [Errors]
FROM tb_Mailer_mailing INNER JOIN
tb_Mailer_Smses ON tb_Mailer_mailing.Id = tb_Mailer_Smses.MailingId
WHERE tb_Mailer_mailing.ApplicationId = 1
GROUP BY tb_Mailer_mailing.Id
Is there some one who can me show me the convertion process ?
I have a strange problem:
There is an entity (Table) called "Filters" in my .edmx which has all my tables and stuff in it (to use it for LINQ queries)
I have created a class called "CustomFilters" which inherits "Filters". So now my cutom class has all the properties of the original "Filters" class (table) and 1 more additional property that i wanted which is a List of "CustomFilters":
List<CustomFilters> children = new List<CustomFilters>();
Now i get all my records into:
List<CustomFilters> theOriginalList = new List<CustomFilters>();
NOTE: first all records are tken into a List<Filters> and then these are added into List<CustomFilters> where List<CustomFilters> for children of that record is added, and then children of the child records, and so on......
so now, every record is an instance of CustomFilters which has a property named "children" which is a list again; and each child again has instanaces of "CustomFilters", and each instance again has children...and on and on and on.....
(basiacally its a data source for a treeview in my silverlight control)
every thing is good and working as expected.