How To Write A Class That Return More Than One Value

Apr 19, 2010

can you give some information about how to write a class that return mor than one value

for ex. i want to create a class getSettings("UserName") that return the language and theme for that user.

View 2 Replies


Similar Messages:

Web Forms :: How To Write A Function To Return A CSS Class Name

Jan 24, 2010

I'm new to C# and ASP and can't seem to figure out how to write a function to return a CSS Class name.

Here's what I have so far:

In "MyWeb.master" I have a line that reads:

<asp:HyperLink ID="HyperLink1" text="xxxxx"
cssClass='<%# MyCssStyle("ddd") %>'
NavigateUrl="http://www.RDRR.com/Catalog.aspx?TribeID=1"
runat="server" />

And in "MyWeb.master.cs" I have a routine within the partial class that reads:

public string MyCssStyle(string myInput)
{
myInput = "NavigationBarUnselected";
return myInput;
}

This code does not throw an error, but neither does it return a value. What have I missed?

View 8 Replies

WCF / ASMX :: Write Some XML Data After Web Method Return?

Jul 19, 2010

I am coding a classic .asmx web service. The method get data (as a string) from a server, then assign data to an object, then return that object. But I want to cache that object to a XML file for other request. It's because the data from server is not frequently change. Thus, after some minutes, I have to refresh the XML file. When I refresh XML file, I could write object to XML first, then return that object, but that approach maybe slowly.

How can I return the object for client first, then write this to XML file?

View 5 Replies

WCF / ASMX :: How To Return And Write SOAP Responses

Mar 14, 2011

I have been given access to a web service that I can use to pull valuable data for my company. The issue I am having is I don't know where to begin writing out the returned values. I am using an asp.net VB web file to connect to the web service and call the wanted procedures. I have added the web service as an web reference in my project, other than that I am stuck. Here is what I have so far;

[Code]....

So basically I am writing out an array but it comes out like this;

[Code]....

This is not the expected the return but from what I understand the VeroWebService.SaleModel is like the parent xml/SOAP element.The expected return is more like;

[Code]....

View 4 Replies

WCF / ASMX :: Write Method Which Will Return From Data Entity

Jun 11, 2010

What i need to do: When i click button on my .aspx page WCF service should be called, which should return data from ADO.NET entity data model. Entity data model and webservice is already added. I just have to write a method which will return data from data entity.

View 2 Replies

WCF / ASMX :: How To Write A Service To Return The Filenames Starting With A String

Feb 6, 2011

I have number of files stored in a folder.

I want to write a wcf service to ruturn a list of filenames based on the text typed in a text box.

The structure of the method i need is something like this :

[Code]....

The requirments is to return only the filenames that starts with the typed text. Only the file name part is required not the full path.

View 3 Replies

Return Xml From A Method Inside A Class?

Nov 24, 2010

I have a class file called ShoppingCartClass.cs. Inside ShoppingCartClass I have a method called CanadaPostShipping.

CanadaPostShipping get passed a lot of variables and then builds an xml, sends it to CanadaPost url and gets back an xml file with the shipping rates.

I would like to pass the xml back to my webpage so in my web page I can check that it has status ok and then extract the information I need.

My testing calling routine looks like this:

[Code]....

The start of my CanadaPostShipping routine looks like this

[Code]....

This is my current ending spot in CanadaPostShipping....where I am getting back the correct xml from CanadaPost

[Code]....

As you can see I am saving it to my thumbdrive.....

What changes would I have to make to my calling routine and the method in the class to return xml "mydoc"?

View 1 Replies

Write A Class For Retrieving IEnumerable Objects In EF And C#?

Mar 7, 2011

In my Code Behind I use several times this code below to bind and rebind (for refresh) e GridView after an insertion or other operations completed using EF objects.

Using a simple gridview.DataBind(); does not work because I call EF programmatically so I thought to use a Class to keep in memory this code that can create Objects for my GridView and call it how many time I need in my code avoiding redundancy.

IEnumerable<CmsContent> queryContents = myCurrentSlot.CmsContents.Where(x => x.IsPublished == true);
uxManageContents.DataSource = queryContents;
uxManageContents.DataBind();

Or do you know a batter way to Refresh the gridview after EF executing some commands? how to do it?

remember that I do use any data source web control for the gridview but i bind it programmatically.

View 1 Replies

C# - Use DirectorySecurity Class For Getting Write Access To A Directory?

Nov 3, 2010

How we can use DirectorySecurity class for getting write access to a directory?

View 1 Replies

Web Forms :: How To Write A Code In Class File

Aug 2, 2013

I have a code which saves the control id and its text in database..(and it is working fine).This code is written in default.aspx.cs which will save all the controls(of deault.aspx) id and name in database.I want to make a class file and then call this class file in page rather than writing the code in page because there will be multiple pages where this can be called.write this function DisplyDetails() in class file..code is as below..

public partial class _Default : System.Web.UI.Page
{
string controlId, propertyValue,other;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["abc"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)

[code]...

View 1 Replies

AJAX :: Return Class To Javascript From Webservice?

Aug 31, 2010

I know i've seen a tutorial for this, but can't locate it anymore. I have a class Employee in c# side, I also have a webservice where I pass in an ID# and an Employee object is returned. Now I want this object returned to Javascript code, I know I've seen it done before, can someone point me to a tutorial that shows something like this being done. I'm using the MicrosoftAjax.js file.

View 3 Replies

MVC :: Write The Code Which Translates The Language Property Into A CSS Class?

Dec 22, 2010

I'm having problems drawing the lines on what code goes where in the following case. What goes in the View, Controller and Model. It should be noted that this is my first MVC project.So I'm building a bilingual site where the user may select either English or Norwegian language. I want the user to be able to choose language with a link at the top of the page. The link for the selected language at any time is emphasized with a certain CSS class.

The user setting with the selected language at any time is stored in a cookie at the client. When a request is done, the cookie is parsed and the settings are objectified as a part of the Model the way I've implemented it as of now (please object if you find this weird, but this is not the main focus of this post). I.e. a super-class which all my models inherit from, has the UserSettings class with the Language property.Now, where do I write the code which translates the language property into a CSS class?Option A, the View: I envision some code which interprets the language and output one of two possible lines of code based on this. We'll have IF's in the View.

Option B, the Controller: Logic in the Action method sets a ViewData-property with the name of the CSS class for both the link to the Norwegian and the English language.

Option C, the Model: I create a new property in the Model doing the same thing as the code in Option B. Except now I get strongly-typed parameters in the View and intellisense. (But I do suspect you guys will not like this solution for separation-of-concerns-reasons)

Option D, the ViewModel* I create a new class which is a ViewModel for the Model with the same property as in Option C. Now I get better separation of concerns.Yes I know there's no ViewModel in MVC, but I also know some people implement it anyway.

So what do you say? A,B,C or D? Or maybe you've got an E?

View 3 Replies

C# - Write An Async Class With A Minimal Amount Of Repeated Code?

Jan 10, 2010

how do i write a async class like WebClient? Is there anyway i can keep it short and does not have to repeat it for every method?

for example, i have:

Download(string a)
Download(string a, string b)

do i have to rewrite Async + Complete method for each of these?

View 4 Replies

State Management :: Session Used In Thread Class Return Null

May 5, 2010

I want to use session in thread class but it return null in parent that is the page class.

View 4 Replies

VS 2010 - Create Class To Return Data As List Object

Dec 4, 2013

I have a Google spreadsheet that I am reading data from and I want to load the data into a list object so I can use but I am having some issues.

Google Spreadsheet
-Worksheet name: Charts
-Tab: Color_Summarized
-Column 1: ColorSummary
-Column 2: ChildID
-Column 3: ParentID

sample rows:
Aqua|29|28
Blue|49|23
Yellow|55|28

My results are
Yellow Color_Summarized FH 55 28

How do I need to set it up so it keeps all the data loaded instead of just the last instance? Is there a better way then putting in class?

My code:

Code:
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Collections.Generic
Imports Google.GData.Spreadsheets

[code]....

View 3 Replies

Accessing To Request Object Will Lead To ReadEntityBody To Return 0 (in A HttpHandler Class)?

Dec 25, 2010

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;

View 1 Replies

MVC :: Out Of The Box MVC2 Controller / Delete Controller Is Refusing To Return Any Class Information

Nov 6, 2010

my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.

Function Delete(ByVal id As Integer) As ActionResult

View 4 Replies

Verbatim - Why Write @ Before Sql Queries - Select Data From Database Then Write Query?

Oct 1, 2010

Suppose we want to select the data from the database then we write the query for that. Example:

SqlConnection con=new SqlConnection(Connetion name) string selectPkId = @"SELECT PK_ID FROM TABLE" SqlCommand cmd=new SqlCommand(selectPkId ,con);

So,my question is that why we basically use @ before the sql query.If I don't use @ before that then it again work fine (does not give any error), then what is need of using "@"?

View 1 Replies

Web Forms :: Write In Chunks / Parameters Are Not Supported For The Write Method

Mar 29, 2011

I am reading in a file into a string. Then I am writing this string to a stream. I know this code works fine.

The only problem that I have is with the line that write the data in chunks where the parameters is not supported for the Write method.

The line that has the problem is this line. What do I need to change here?

OutPut.Write(buffer, 0, Math.Min(to_write, WRITE_CHUNK));

[Code]....

View 2 Replies

SQL Server :: DAL Doesn't Return The Return Value Of Stored Procedure?

Nov 8, 2010

I have an update function in my data layer which is defined as:

public int UpdateRBTable(parameters ...) This calls a SQL Server Stored Procedure to perform an update function on the database.

The process does its job for updating the table. However, the stored procedure has a return value (which indicates how many rows were updated), but this return value is not returned to the application. The application always shows that a zero was returned from the stored procedure.

View 3 Replies

Write Response.write Within Update Panel?

Oct 6, 2010

i am calling a function which is inside Homescroll.ascx.cs from Homescroll.ascx so i wrote on Homescroll.ascx as <% Response.Write(scroll()); %> but all this is in update panel,and i am getting errors. so is their any other way to call function from homescroll.ascx to homescroll.ascx.cs,instead of response.write();

View 3 Replies

Can WebMethod Return An XmlDocument As Return Type

Jan 22, 2010

Can my WebMethod return an XmlDocument as return type?

When I try to consume the web service I'm still not getting XML. It appears as though a reference to the method is being returned rather than say a string containing XML.

<WebMethod()> _
Public Function CustomerSearch(ByVal lastName As String, ByVal firstName As String, ByVal companyName As String, ByVal city As String, ByVal state As String, ByVal email As String) As XmlDocument
' Create XML doc
Dim doc As XmlDocument = New XmlDocument()
' some more code
Return doc
End Function

View 4 Replies

MVC :: How To Return 401 Error From A Method Return ActionResult

Sep 28, 2010

how can i return 401 error from a method return ActionResult?

View 1 Replies

Assign A Value To the Methods Return Var before Return The Final Value?

Dec 2, 2010

How can I assign a value to the methods return var BEFORE I return the final value?

Example:

public string Example()

{
[here I want to assign a value to the return var and continue this block until the end] = "TempStr"; [code].....

View 2 Replies

How To Get C# Return Dropdown List To Return Value As Int

Jun 8, 2010

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?

View 2 Replies







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