I have a business object class BusinessObject which implements an interface IAlternateInterface. I already have a method that will return a generic list of BusinessObject which has the objects I want but I want to get them as a list of IAlternateInterface. I tried to do something like the following psudo code but I am getting a "Can not convert source type ... to target type ..." message in Visual Studio. What is the best way to convert the list?
public List<BusinessObject> GetObjects(){
//logic to get the list
}
public List<IAlternateInterface> GetInterfaceObjects(){
return GetObjects();
}
I am converting an old PHP porject over to ASP.Net (vb) and wondered if someone could point me in the right direction in order to convert this final snippet of code.
There are 3 functions that are called from within this and i ahve converted those already and to be honest is the session arrays that are giving me the headache.
I have thought about using Hashtables and DirecCasting but this was just confusing me further.[code]....
I am converting an html into pdf, I have observed that the pdf is getting generated but not properly. i.e. the Datalist2 and the gridview2 present inside the Datalist2 is not getting populated.
I have been tasked with sifting through the worst classic asp spaghetti i've ever come across.The script runs a series of recordsets in sequence, getting 1 record at a time. As the record is built it takes the id and passes it to the next loop, which gets data, and passes on the id to the next loop. It then continues in this manner and builds an unordered list, kicking out the required html
Today I faced a strange problem in C#. I have an ASP.NET page where user can enter certain price, quantity etc. I get the price value, convert it to double, then multiply it with 100 and then typecast it to an integer. When the price is "33.30", after converting it to double it remains 33.3 (obviously...), but after multiplying it with 100, it becomes 3329.9999999999995, and when I cast it to integer by applying simple cast operator "(int) (price * 100) ", it becomes 3329.Right now I have no idea why this is happening.
Im after some advice on date format conversions. I am working on a project that has raddatepicker controls that will take values chosen in the UI and uses them as constraints on a SQL query going back to the database.
My problem lies in the fact that the UI has a sensible date format (dd/mm/yyyy), whereas the database stored dates as "the number of seconds past 00:00:00 01/01/1970". In T-SQL, I can convert using:
[Code]....
I have no idea how to achieve this same conversion in C# so the user can choose a friendly format, but subsequently pass back the database date format.
etailsView is bound to ObjectDataSource. Inside Detailsview's EditItemTemplate are two TextBoxes ( T1 and T2 ). T1 is mapped to update parameter of type String, while T2 is mapped to update parameter of type DateTime. ssuming both TextBoxes contain an empty string, then when I try to update the data source by clicking on DetailsView's Update button, ODS ( or is it perhaps DetailsView ) automatically converts T1's empty string to null, while T2's empty string doesn't get converted to null. I've tried to prevent ODS from converting T1's empty string to null by setting T1's update parameter's ConvertEmptyStringToNull property to false ( I 've also set <asp:TemplateField ConvertEmptyStringToNull="false" ...>, but to no effect.a)Any idea why T1's empty string gets converted, while T2's doesn't?b) Also, how can I prevent the conversion( BTW - I realize I could convert null back to empty string inside update method )?
I've asp.net 2.0 ajax enabled web site in which I used Ajax update panels in pages. Now I want to convert it into asp.net 3.5 but it gives errors for Ajax tool kit and script manager and update panel used in pages. I don't want to remove ajax functionality from my site, so is there a way to convert them without removing ajax update panels from pages.On my PC I've installed both VS2005 and VS2008.
I have a Visual Studio solution created in 2005 and I want to start working with it in 2008. I opened it and it was run through the wizard. My first error is a message that says: The Web Applicatin Project is configured to use IIS. You must install the following IIS components: IIS 6 Metabase and IIS 6 Configuration Compatibility.So, I googled that and found this:IIS 7.0 is included with Windows Vista. However, when you first install Windows Vista, by default IIS 7.0 is not enabled. This topic describes how to enable IIS and configure it so that in Visual Studio you can create local IIS ASP.NET Web sites. This enables you to use a local copy of IIS to run and debug the Web site instead of using the ASP.NET Development Server.The bold is mine, because I want to know why I can't just use the ASP.NET Development Server? I always have in the past. Oh, and I'm not running Vista, I'm running Windows 7, but I don't think that matters.
I have a web page which generates a .CSV file based on some user input. When this file is downloaded by the user, the file is being automatically converted to .XLS. Any idea how I can prevent this?
For example, I am redirecting the user to the URL of the generated file, like below URL:
http://localhost/reports/Work/aa.csv
But the download window appears to download "aa.xls"!
I need to convert the word doc to pdf, ofcourse i did it,But i converted only simple word file that has only strings. But I need to convert the word doc that has images tables with all formatings how Can i achive it.
i want to know if the only way to get information from database and transform them into objects is with a datareader or with a dataadapter and them looping throw the datarows, cause i have a lot of records in the table and i have to find the fastest way to do it. (like 10,000,000 records).
I just realize this difference in date conversion: In SQL server, if you run the code below
declare @dateStr varchar(20) set @dateStr = '1/1/49' select cast(@dateStr as smalldatetime) you will get "2049-01-01 00:00:00" In .NET taking string with value "1/1/49" and it will turn into 1/1/1949 12:00:00 AM DateTime dateObj; dateObj = DateTime.Parse("1/1/49"); Label1.Text = dateObj.ToString();
Can anybody tell me why Microsoft did this and what is the best way to prevent user from entering 2 digits year?
I need to export the data from .dbf file to sql server2000. if any body can guide me how to do that. I'll be really grateful. DBF file has lakhs of records which need to be transffered.
I have a field called IsAdmin in my user database which is a bit and i have used a checkbox for entering its value in my forms...but i get an error
Conversion failed when converting the varchar value 'System.Web.UI.WebControls.CheckBox' to data type bit. How do i sort out this error....and i want IsAdmin to be either 1 or 0 in my database
I am a .net developer and I am in search of a tool that can convert HTML pages to ASPX pages?So, can you suggest me such tool? Does anyone having an idea for such conversion?
i m facing problem in converting .html pages to .aspx using c#secnario isi got one index.html pagei have to convert index.html into .aspx pages and that to in four pastop part as a.aspxmiddle part as b.aspxbottom part as c.aspxand then in d.aspx i have to combine all the three parts and call them in d.aspx...
I'm trying to show something like "contáctenos" in uppercase, but when I use the string.toUpper() method I have the strange result "CONTáCTENOS" instead of "CONTÁCTENOS". The page "culture" is set correctly to "es-ES" and the "uiculture" too.How can I obtain the correct result if it's possible, without using regex or replace.
I've asp.net 2.0 ajax enabled web site in which I used Ajax update panels in pages. Now I want to convert it into asp.net 3.5 but it gives errors for Ajax tool kit and script manager and update panel used in pages. I don't want to remove ajax functionality from my site, so is there a way to convert them without removing ajax update panels from pages. On my PC I've installed both VS2005 and VS2008.