Person class contains data objects such as first name, last name etc.
I want to add all first names to a dropdownlist. How can i do that? I tried doing it like this, but it won't get the first names:
ddl_traders.DataSource = traders;
EDIT
Person has the following string fields: FirstName, LastName, login.
I want the dropdownlist to display FirstName, but the value has to be the logins. I'm fairly certain that is possible, although I have no idea how it can be done.
For some unknown reason I suddenly am unable to create an object variable for a Linq Data Class. If I create a new project and try the process again with the same database everything works as advertized.The code I am using is Dim db As New RoggDataContext which gives me an error on the object variable "db": Overload resolution failed because no accessibility 'NEW' accepts this number of arguments.I have looked inside every file in the Web Project like the web config to check the connection string, gobal, and designer.vb looking for any errors whit no JOY. I also tried to create a new form and code behind with a button and received the same error.This is mind blowing because as I already stated, I can create a new Web Site and the problem goes away.
I created a httpHandler that successfully implements IHttpHandler for handling file uploads. It works perfectly fine. You send the file with the form, the class receives it and will save it to hard disk. It reads chunks of file with ReadEntityBody function of HttpWorkerRequest class.
Here is the situation i'm faced with.If at any stage before trying to read the file with ReadEntityBody, I try to access Request object (even Request.InputStream.Length!) ReadEntityBody would return 0 means it won't read from file stream.
After further testing I found out the reason behind it. Accessing to Context.Current.Request object will trigger some sort of functionality that will cause asp.net to handle file uploads at that moment by it's own! I believe this is a bug.
for example exactly after this line of code, asp.net will upload the file completely, and so there will be no stream for ReadEntityBody to read from later.
int FileSize = context.Request.InputStream.Length;
1) I want to know what is the recommended way to create & return a DTO for an object which has 10 attributes and I only want to return 2 with my DTO object.
2) Should DTO's have their own namespace ? If yes, how do we organize them ? Each DTO inside a single class file or all DTO's inside a single class ?
I am having a trouble while trying to create an entity with a custom view modeled create form. Below is my custom view model for Category Creation form.
[code]....
When i click on save button, it doesnt bind the category for me because of i am using custom view model and strongly typed html helpers like that
Why do we use the reference of abstract class (or base class) to create object of it's sub-class. eg: TextWriter is the abstract class for StreamWriter & StreamWriter.
The number of fields may grow with attributes for more specific product tyes. The description may contain a large amount of data. I want to create a slim version of this product class that only contains the data needed. I'm only displaying 4 of the 12 fields when listing products on a category page. It seems like a waste to retrieve all of the data when most of it isn't being used. I created a parent class of ProductListing that contains the 4 fields I need for the category page
ProductId ShortTitle Price Img
Then created a class of Product that inherits from ProductListing containing all product data. It seems backwards as "ProductListing" is not a kind of "Product" but I just started reading about inheritance a few months ago so it's stil a little new to me. Is there a better way to get a slim object so I'm not pulling data I don't need? Is the solution I have in place fine how it is?
My question is, is there any benefit to instantiating a new userDetails object in every loop, or can this be created outside the loop and title, forename and surname just written over with every pass of the loop?
In my controller I fetch a list of object 'object1' which has two fields field1 & field2.Now I have a model model1 which has two fields fieldsX & fieldY.fieldX = field1fieldY = dosomething(field2 also have a view model ViewModel1 which has a single fieldpublic List<model1> model2I need to send model2 to my view
Iam trying to create web magazine, I finished the current issue page and the articles pages of it. What I need now is two things:
1. Creating cms for the web (Big Story! )
2. Finding the way to save the old issues and retreive them when click back issues button and choose the date of i. It is easy if I used db.but I can't!!! I need to save the aspx pages with code of each one! to use C# to create class contains linked list and save the issues in it but I don't know how to do it how to start searching?
I am wanting to get the function below from the file pageDAL.cs to return the object page with the values for whatever pageID I pass in. If I do not need to use a DataSet or DataTable that is fine. What is the best way?
public page getPage(int _pageID) { DataTable dt = new DataTable; using (SqlDataAdapter da = new SqlDataAdapter("select PageID,ParentID,CategoryID,Name,PageHTMLContent,NavigationText,TopMenu,SubMenu,DisplayOrder,Active from Page where PageID = " + _PageID, ConnectionStrings.StaceysCakes))........
Return myDataReader I have a function which is retuning a datareader to various sections of my website which is then being bound to dropdown lists, gridviews, etc. Normally the last line in a function when is the data reader and connection getting closed? Is it best practive to return a data reader or a dataset/datatable (or something even better than these two)?
How to get asp.net return drop down list to return value as int
I want to pass the value to a stored procedure as an integer. But the default appears to be as a string which is not what the store procedure is expecting.
Is there a good way to return the list values as ints?
I suspect I can you set the value on the change selection event, is there another way?
I am trying to retrieve asp.net C# List method in JavaScript by referring Send-and-receive-JavaScript-Array-to-Web-Service-Web-Method-using-ASP.Net-AJAX ..My Code as below
Javascript
<script type = "text/javascript"> function GetAllSVGData() { PageMethods.GetSvgElements(OnSuccessSVGElements); } function OnSuccessSVGElements(response) {
[code]....
My problem is JavaScript function OnSuccessSVGElements is not firing. When I put breakpoints in it is working fine in C#. C# Method Working But Alerts in javascript not working.
I have 2 pages in my project (that are causing the problems). My default page has a FormView that for some reason will not let me access page events, such as buttons for instance, in code behind. They show up fine on page but are not visible in the page events drop down in code behind. We are using a work around for that.
The main issue now is that on my ViewTaxes.aspx page I need to get the values of some of the text boxes from the default page by Control Number, i.e. whatever record is being viewed on default page when you click the ViewTaxes link button, much more detailed information about that particular record is displayed on ViewTaxes. If on ViewTaxes I use a SELECT * statement I can access the ViewTaxes page when I click the button. We, of course, need to filter the data displayed by ControlNumber. When I add a WHERE clause to the DS on ViewTaxes page and click linkbutton on the default page I get an Object Reference error. This error seems to have something to do with a group of textboxes that are displayed via Session in codebehind. Values from default page being displayed in one section of ViewTaxes page. The error when thrown always points to Session("Owner1") = txtCust1.Text. If that code is removed then error will go to next Session variable, an so on.
I should also point out that both pages worked fine, no problems at all, using a test MySql table. We recently migrated the actual table that will be used from an Access database and replaced the test table. Can't find any spelling errors or anything of that nature. There are some Null fields in this database but it is set to allow Nulls.