C# - Can Combine Two Objects Into One

Oct 3, 2010

I'm preparing to pass values to a method:

private string BuildMessage(int templateID, string body, object data)


where the data param is an array of name/value pairs. To prepare my values for that data param I need to combine the properties of a strongly typed class with the values of a simple 2d array.

What's the best way to merge those values?

View 1 Replies


Similar Messages:

Forms Data Controls :: Binding A Repeater To A List Of Objects That Have Child Objects?

Nov 17, 2010

have some Objects, lets say Employee and Role defined as below and I have defined relationships in my database that gives me a list of objects say employees and thanks to my framework each employee object also has a Role object linked via the RoleIDID, UserName, Password, Email, RoleIDRoleID, RoleNameSo in code I can do something like this

Employee emp = dataService_GetEmployeeByID(1);
string RoleName = emp.Role.RoleName;

Now here is my problemI can bind any object in a repeater and it works fine for the first level in my relationship

For instance <%# Eval("UserName") %>

But I need to be able to show the details for my child objects as well (Role) so something like this (which does not work)

<%# Eval("Role.RoleName") %>

View 2 Replies

Forms Data Controls :: Binding An Objects(containing Sub Objects) To A Dropdown List?

Apr 6, 2010

I know how to bind a simple objects to a dropdown list. However I am having problems binding my objects which contains sub objects to the control.i.e. with simple object i just do ddl.DataValueField = "myproperty"
with my objects they contains sub objects which i want to bind. I have tried ddl.DataValueField = "sub-object.myproperty" which doesnt work.

View 2 Replies

Architecture :: Using Static Methods To Build User Objects And Various Other Objects?

Jun 21, 2010

firstly a static class only ever exists once and is not an instance. Any static members (ie static int NoOfPeople;) is stored in one place and is shared between all sessions (like the old global variables).
Now static methods is where i'm not 100% sure. If I have a static method that doesn't use any other static members could this cause inconstant results, example (this is a fairly pointless method but just a quick example of the top of my head)

[Code]....

So in this example if two sessions (or threads) were to call this at the same time - would they both get back the expected results, because the method only uses private data (a, b and totalToReturn).Im sure this sounds a little simple but I will be using static methods to build user objects and various other objects that there will have to be a 100% garentee that the objects will not get mixed up between sessions and the wrong things return to the user.

View 5 Replies

Dynamic Data Be Made To Work With Custom Business Objects Rather Than Data Objects?

Feb 24, 2010

I'm working on a project in which we have a database, data layer (entity framework), business layer and web/UI layer.I want to use ASP.NET Dynamic Data for the web layer, but don't want it to access the data layer or database, as I want it to be purely running off business logic, and not directly accessing the data.However, it appears that Dynamic Data only allows Linq-to-SQL or entity framework data sources to be used.Has anyone used it with business-layer objects instead?

View 1 Replies

State Management :: How To Link The Objects Between Browser Session And Session Objects

May 10, 2010

Lets say I am doing a shoping cart. I authenticate the user with a session variable.For example:

If(Request.IsAuthenticated)
// Here I want to add to the shoping cart.
// Can I do the following
Session["Cart"] = "Washing Machine";
Now will this Session["Cart"] value which is washing machine here be unique to diff customers?

View 1 Replies

What Application Objects Or System Objects Are Stored In The Application Pool

Feb 1, 2010

I hosted my application in production. Within 5 to 6 hours the application pool spikes and uses more memory?

What application objects or system objects are stored in the application pool?

View 3 Replies

SQL Reporting :: Can Combine LIKE And IN

Nov 4, 2010

I have a report with several filter parameters. Everything works fine presently. For one parameter, I use the LIKE as follows in my WHERE statement:

WHERE drug LIKE '%' + @drugused + '%'

@drugused is the selection value of a dropdown list. But now I want to change my parameter to allow multi-selection. But I am not sure how to write my WHERE statement for this. Normally I would use IN but I'm not sure how to do this with the LIKE.

View 6 Replies

Utility To Combine Querystrings?

Apr 28, 2010

Is there a utility to combine querystrings? I'm looking for something like:

Input: Combine("test=a&test2=b", "test3=c") Result: "test=a&test2=b&test3=c"
Input: Combine("test=a&test2=b", "") Result: "test=a&test2=b"
Input: Combine("", "test3=c") Result: "test3=c"

And maybe some weird ones:

Input: Combine("&test=a&test2=b", "?test3=c") Result: "test=a&test2=b&test3=c"

View 5 Replies

Combine Silverlight) With SAP Webdynpro?

Mar 1, 2010

Does anybody knows possibilities or approaches to combine ASP.NET with SAP Webdynpro (or to embed/integrate Webdynpro in a ASP.NET (or Silverlight) application) ?

View 2 Replies

C# - Combine MP3 Files In Response?

Jan 19, 2010

I lied! The commandline fails if the two source files have different bitrates (does samplerate matter?). Also, the source code below succeeds when the two sources are the same bitrate. So, this looks like a bitrate challenge now.

Original question:

result.mp3 (from the commandline, below) is playable in WMP11. The ASP.NET code below serves a file which plays fine in WMP11. But, when I uncomment those two lines, WMP11 won't play the file. Something about the code that merges the two MP3 files isn't to the satisfaction of WMP11. How can I change the ASP.NET code to merge the two MP3s in the HTTP response with the success that the 'copy' commandline gives me?

protected void Page_Load(object sender, EventArgs e) {
Response.Clear();
Response.ContentType = "audio/mpeg";
Response.AddHeader("Content-Disposition", "attachment; filename=test.mp3");
var bytes1 = System.IO.File.ReadAllBytes(@"C: est1.mp3");
WriteBytesToResponse(bytes1);
//var bytes2 = System.IO.File.ReadAllBytes(@"C: est2.mp3");
//WriteBytesToResponse(bytes2);
Response.End();
}
private void WriteBytesToResponse(byte[] sourceBytes) {
using (var sourceStream = new MemoryStream(sourceBytes, false)) {
sourceStream.WriteTo(Response.OutputStream);
}
}

copy /B test1.mp3+test2.mp3 result.mp3

View 3 Replies

Can Combine WebResource.axd CSS Requests

Sep 15, 2010

I have developed some ASP.NET server controls which include their own javascript and css files. A lot of these controls use jQuery extensions which, as you know, often include their own css files.

I'm using Telerik's RadScript manager which combines the javascript like a boss. However, I'm using the AjaxToolkit's ClientCssResource attribute to include the css files in my server controls, and I have noticed that the CSS files are not getting combined at all. My pages have 10-15 WebResource.axd requests for css files for my server controls.

Everything I find only is about combining javascript, and nothing tells me how I can combine the CSS files. Does anyone know if there is a way to combine the CSS dynamically (I don't want to manually combine as each page might use a different subset of the server controls)?

View 2 Replies

SQL Server :: Combine Two Querys Into One?

Feb 9, 2011

My query below

SELECT
WORKORDER
WORKORDER
[dbo]
WORKORDER.ACCT, MASTERFI.NAME1,
.TICKET_RECV_DT, WORKORDER.WORK_ORDER_NUM,
.LAST_ACTION,WORKORDER_DETAIL.WORKER
FROM [dbo].WORKORDER,
.MASTERFI, [dbo].WORKORDER_DETAIL.......

I want to combine two querys into one, how do i achieve this result?

View 4 Replies

Combine Script# And Web Controls?

Jan 21, 2011

I currently have a Web Application project in VS2010. Each control (in *.ascx files) is contained in it's own separate folder along with the web services used by that control (in *.asmx files) and the javascript object used to manipulate it (in *.js files). So the project layout looks something like:

WebApp/
WebControl1/
WebControl1.ascx
WebControl1.ascx.cs
WebControl1.ascx.designer.cs
WebControl1.asmx
WebControl1.asmx.cs
WebControl1.js
WebControl2/
Global.asax
Default.aspx
Default.aspx.cs
Default.aspx.designer.cs

The project is expanding and I'm looking to upgrade and replace the .js files using Script#. I'd like to maintain this structure but as far as I can tell there's no way to mix Script# and regular C# files in the same project.

I've looked at the Readme PDF on the Script# site and downloaded the PhotoDemo example but I can't find any examples of using Script# along side Web Controls. I've tried adding the 'Script Support' template to the project and then adding both Class and Page templates from the Script# template list but they both get treated as regular C# source code files.

I've used reflector to look into the mscorlib, System.Web, ScriptSharp.Web, ScriptSharp.VisualStudio, ScriptSharp and Script.Windows binaries that are installed by Script# and haven't been able to find anything that would allow this behaviour.

Has anyone implemented something similar or have any further hints?

The only way I've managed to use Script# at the moment is to have a separate Script# project and have the output for the javascript files be inside my Web Application.

View 1 Replies

Configuration :: Combine Two Websites Into One?

Jul 27, 2010

i am new in asp.net i dont know to how to combine two asp.net web site into one like domain and subdomain concept. i know the procedure to host one web application in local iis. how to combine two application and how to host in local iis i.e) single url as domain(one web application) and subdomain(another web application).

The url should be like these:

http://localhost/firstapplication/

http://localhost/secondapplication.firstapplication/

View 3 Replies

ADO.NET :: Combine 2 Linq Queries?

Jul 27, 2010

Is it possible to combine these 2 linq queries ?

[Code]....

View 2 Replies

Cache Combine Two User Data

Mar 15, 2011

I have a master/detail web form and i have implement a caching to hold detail data. i am facing problem that when two user login same time and enter data, cache has combined the data and both user ara getting each other data. i want every user gat his own data.

View 6 Replies

AJAX :: Way To Combine Script Languages

Dec 14, 2010

I had to rebuild my development environment after my hard drive crashed. Before the crash I used ScriptManager with CompositeScript tags to combine js files using AjaxControlToolkit, version 3.0.20820.29441. Now I am forced to use AjaxcontrolToolkit version 3.5.40412.0 which insists that I use ToolkitScriptManager which seems to combine ALL Ajax controls instead of the ones I specifiy in CompositeScript. And when I use the attribute CombineScriptsHandlerUrl="~/CombineScriptHandler.ashx" (the latter from SampleWebSitethat comes with AjaxControlToolkit) I see in Fiddler that the ashx file cannot be found.

View 1 Replies

Web.config - How To Combine The Authorization Rules

Jan 28, 2010

I have the following authorization rules in my web.config:

[code]....

Except for the path attribute these two rules are the same. Is there a way to combine these two rules into one like path = Register.aspx, ForgotCredentials.aspx.

View 3 Replies

C# - Combine Multiple DataViews Into A Single One?

Mar 3, 2010

I have 4 different select statements which i sequently assign to an sqlDataSource like this:

sqlNoutatiProduse.SelectCommand = select;

and i keep the results in different DataViews like

MySession.Current.dataViewNoutatiProduse1 = (System.Data.DataView)sqlNoutatiProduse.Select(DataSourceSelectArguments.Empty);

Is it possible to combine into a single DataView the results of these queries?

View 1 Replies

Combine Two Datatables Into Single Datatable?

Oct 27, 2010

I am trying to combine two datatables into single datatable... First table contains 3 columns[e.g: 'col1','col2','col3'] Second table contains 2 columns[e.g: 'col4','col5'] Both tables have the same no.of records[rows], but different columns. How to combine them into single table? I need DataTable with columns ['col1','col2','col3','col4','col5']. I am inserting through looping the both the tables and adding values into third table. I tried the Merge (DataTable.Merge()), but it is adding the records to bottom of first one, but i need it should be added to the side[as columns] to first table'

View 6 Replies

Web Forms :: How To Combine C# And Html/javaScript

Apr 17, 2010

i got a question that realy bothering me .... for the last 24 hours ...

how to combine c# and html/javaScript .....??

so ... the question :

for example i create a varible in my asp.net form .......

int variable = 2;
// some function .....
protect int makeItdouble(int variable)

{

return variable*2;

}
variable = makeItdouble(5); // some code i

and now i want to take this "variable" into my my javascript code .... this important thing is that i want thet this function will run first .... (the C# function)cus i take first my DataBase from the server and that prosses him more with some javascript code ...

View 10 Replies

C# - Combine Javascript/CSS Into One File Or Two For Better Optimization?

Jan 24, 2011

I am currently working on an c# application that minimizes and combines javascript/css asynchronously in the background to load on to the page which completed. Once the combined minimized file(s) are created, they are saved on to disk and all subsequent requests to the page will load this file.

The reason for this is to assist with performance on the page. I have a concern though, what if the combined file is large, eg 200 kb. Would it be better to combine in to 2 files if this was the case and have 2 separate http requests? The file will be gzipped and cached.

View 3 Replies

Multiple Javascript Files, Combine Into One?

Feb 2, 2011

I am developing in asp.net mvc and using multiple javascript files.eg jquery, jquery-ui, google-maps my own js files etc.for performance should i combine these into one?if so how?

View 4 Replies

SQL Server :: Combine Two Queries In One Resultset?

Sep 6, 2010

I want to combine two queries like :

select name as name1 from table1 where id = 6

and

select name as name2 from table1 where id = 2.

I need a single resultset. How can I do that?

View 26 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved