ADO.NET :: Converting A 'var' To DropThis To A List?
Dec 29, 2010
[Code]....
and XML looks like
[Code]...
and I'm retrieving information using this and it's working fine
[Code]...
Cannot I convert dropThis to a List? When I try to do
List<Contact> contactCollection = dropThis.ToList();
I get this error
Error 1
Cannot implicitly convert type 'System.Collections.Generic.List<AnonymousType#1>' to 'System.Collections.Generic.List<Models.Contact>'
I'm completely at a loss.I've searched Google,forums anf etc.
View 5 Replies
Similar Messages:
Jan 28, 2011
I have a wcf service.In many places I am converting business entity list to datacontract list.
So I am trying to write a generalised method.
I have acheived to convert business entities with out list.
But when we give a list of business entity,it is getting failed.
to convert list of Business Entity to List of Datacontracts.
View 5 Replies
Feb 17, 2011
In C#.I have a list<object>.
I want to convert any datareader result (with data) to a list of objects.
How can I do that?
View 6 Replies
Dec 9, 2010
I am using this
List<JobsMeta> JobsMeta= _db.JobsMetas.Where(m => m.int_OrganizationId == null || m.int_OrganizationId == OrganizationInfo.OrganizationId).OrderBy(m => m.int_SortId).ToList();
ViewData["JobMeta"] = JobsMeta;
now using the view i want to loop through ViewData["JobMeta"]
<% foreach (var JobsMeta in ViewData["JobMeta"]))
View 1 Replies
Oct 1, 2010
I need to convert a SharePoint List to ASP.NET, including its column filters etc.
Aside from the underlying data which will be housed in a SQL Server table, what are good control choices on ASP.NET side for this? (I'm not sure if ASP.NET Gridview will have all the necessary features.)
View 3 Replies
Aug 27, 2010
I am converting my datatable to LISt using LINQ how do I handle nulls coming from database
List<Port> portDetails = new List<Port>();
DataTable dt = ds.Tables[0];
portDetails = (from q in dt.AsEnumerable()
select new Port
{
PortCode = q.Field<string>("Code"),
ExtCode = q.Field<string>("Nb"),
Name = q.Field<string>("Name"))
}).ToList();
In the above query if Code is null I do not want property portcode to be set to the value it should only set if it is not null or not blank
PortCode = q.Field<string>("Code"),
What should be syntax
I was trying somethign like this which doesnt work
Portcode = q.Field<bool>("Code") == null ? null : q.Field<bool>("Code")
View 1 Replies
Mar 16, 2010
I've data which looks something like this.
[code]....
To convert the above data into unordered list based on depth, I'm using the following code
[code]...
But the resulting unordered list doesnt seem to be forming properly(using which i am constructing a tree).For example "Site " with id '180' is supposed to appear as a direct child of "Televisions" with id '1',is appearing as a direct child of 'Flash' with id '191' using my code.so in addition to considering depth,I've decided to consider itemid as well in order to get the treeview properly.Those rows of the table with itemId not equal to null are not supposed to have a child node(i.e.,they are the leaf nodes in the tree) and all the other nodes can have child nodes.
Update:
The 'itemid' column refers to the id of an item which is present in another table.This column just in identifying if an item has any sub items(i.e., 'name' in my data in this case has any other unordered lists under it).
View 1 Replies
Nov 29, 2010
is there any software I can use that allows me to programmatacilly convert a PSD into a PNG in my asp.NET web application? Where transparenct and quality are preserved.
View 2 Replies
Mar 10, 2010
i'm having a hard time figuring the way on converting my string into an integer number.In my form I have a textbox control from which I get the selected date as string, using the substring method I divide it to month, day and year.The problem is that I cannot, for example, convert the following "12" into the actual integer number twelve. I tried using Int32.Parse or Convert.ToInt32 but still couldn't solve it.Here's my code behind for better comprehension (this doesn't do the trick):
[Code]....
View 5 Replies
Aug 7, 2010
I am converting a webforms app to mvc. I implemented localization in webforms this way: The user selects the language, which BTW can be an rtl language, and the selection goes into the user profile in order for it to persist the next time the user visits the site. I used anonymous profiles. also, I used resource files.The db tables have multiple rows for each language (with a language index field). I also used different style sheets for ltr and rtl languages since I don't use tables on my site (Is there another way instead of using separate style sheets?) What are the best practices for using localization in asp.net mvc ? can I and should I use resource files ? and profiles ? should I map the aspnet tables to linq-to-sql ?
View 1 Replies
Oct 29, 2010
we are in the process of upgrading our crappy cms system and the new assemblies have changed from int to int64. I'm running into a problem when trying to build now. here is one excerpt of code that is causing a problem.
IDictionary<int, string> aliases
= new UrlAliasApi().GetUrlAliasesByType(
Company.DataLayer.Enumeration.UrlAliasType.Recipe);
foreach (ContentBase recipe in mergedResultset)
{
// if alias exists, overwrite quicklink!
string alias;
if (aliases.TryGetValue(recipe.Id, out alias))
{
recipe.QuickLink = alias;
}
}
The error is
Error 323 The best overloaded method match for 'System.Collections.Generic.IDictionary.TryGetValue(int, out string)' has some invalid arguments Its referring to recipe.Id which is an Int64 value.
View 5 Replies
Sep 23, 2010
I have written a desktop application in vb.net. Now I need to convert it into a web application in asp.net. Can you please suggest how I might proceed?
View 1 Replies
Feb 28, 2011
I'm following the ASP.NET MVC Tutorial and having started in VB.NET I'm having trouble converting the following razor code:
I have got
<ul>
@For Each g As MvcApplication1.Genre In Model
<li> @g.Name </li>
Next
</ul>
but getting
Attribute Sepcifier is not a complete statement on both the <li> tags. I understand I need to use line continuation but can't figure out where.
View 3 Replies
Jan 23, 2010
I am trying to convert some code I wrote from VB to C# and it regards Date, Times, and TimeSpans
[Code]....
the First Issue I have is with formats, I have a countdown that displays days left to enter the drawing, I just want a + int displayed no decimals, right now it shows 343.91736271538735 days left to enter drawing.
On The Page it displays Something Like this:
Drawing Date: Sunday, January 1, 2010
Days Left to Enter: 343 Days left to Enter
Right Now it Displays
Days Left To Enter :343.062117332176 Days Left to Enter
View 2 Replies
Jan 28, 2013
im trying to convert this into a repeater but finding it a little difficult trying to figure out how to seperate it and make it work.
Basically the original code is HTML, and I want to use that but since my menu system is coming from a DB, I want to be able to bind that menu system and have it automatically just bind the menus with the x level deep nav bars etc... which this HTML code does:
[URL]
(download the zip file)
Sure, 1 repeater on the page but because this is generic, I know I dynamically have to create and add a repeater and bind the submenu items (and their children if any) to this repeater...and adding this repeater to the current item.
View 1 Replies
Jul 27, 2010
I have a text box; txtPriceQuoted, and want to submit it's value to my SQL Server Database, I get an error about the conversion:
"Conversion failed when converting the varchar value '12.5' to data type int."The error only occurs when there is a decimal point in the number, how should i convert it so that I can input the value into my database....?
View 13 Replies
Jul 6, 2010
I am trying to conver this to C# but Item is not a method in C#
Repno is a string variable of 3 characters
First if rep is not null
then
confirm that Repno the field salespnno from the query.
[code]....
View 2 Replies
Oct 3, 2010
[code]....
the above code only converts controls in dvtext (div) like label name and textboxname to pdf. after entering values into textboxes. it is not convert them to pdf. it only converts control names.
View 3 Replies
Feb 5, 2010
I want to convert HTML page to pdf .
View 2 Replies
Feb 4, 2010
This is probably a simple one for C# people :-) I have this regular expression in javascript:
strVar = strVar.replace(/(specificattribute=)"s*([^"]+?)s*"/g, '$1"$2"');
It replaces leading and trailing spaces inside a specific attribute's value, globally (as per this example page: [URL]). I need to do the same on a string in C#, but when trying the above, the syntax checker chokes at the regExp. So I need the equivalent line of the above in C#.
View 8 Replies
Mar 21, 2010
is there any ready to go solution within the microsoft framework, regarding conversion of date to day?
For example, i would like to convert this string 21/03/2010 (dd/mm/yyyy) to Sunday
View 4 Replies
Apr 17, 2010
there is eny way to convert a string type to uniqueidentifier type .... when i insert or update data , i can give string as a parameter or i must to convert to uniqueidentifier type.?
View 4 Replies
Jul 17, 2010
In ASP.net using VB, how can I Convert a number e.g 4.5 to french (4,5). And a quick question, when storing this in database, will It store as 4.5 or 45?
View 1 Replies
Jul 31, 2010
How to convert SQL Queries to Linq.is their any tool available to convert SQL Queries to Linq
View 2 Replies
Sep 30, 2010
I have this code in c# and I want to convert this to T-SQL and put in stored proc. I'm having a problem in speed as I am processing more than 50000 records at a time and the Update statement slows it down. I was thinking stored procedure could help on my problem. here's what I have:
sqlStmt = "SELECT DISTINCT(phone_no) FROM TEMPTABLE WHERE sUSER='" + USERName + "' ORDER BY phone_no";
View 6 Replies