C# - How To Access Method In Class Library

Jul 23, 2010

I've moved a class in my project into a class Library in the same solution. I've added a reference in the web project to the class library.

How do I access the methods in the class library?

View 2 Replies

Similar Messages:

WCF / ASMX :: Passing A Web Service To A Method In Class Library?

Mar 23, 2011

I have a web service called service1. Is it possible to pass the parameter related to the service to a class library so for e.g.

Service1.service ws = new Service1.service();
Service1.UserDetails ud = null;

now if I call a method that exists in a class and pass ud. Cam i do that because I am trying to do this and I am getting an error. Do i need to add a web

reference to this service in the class library My method call is like this

authenticateUser.Authenticate(ud, UserName);

and in the class libary I have

public void Authenticate( Service1.UserDetails ud , string UserName)

View 3 Replies

C# - Can't Access Class Library In A Web Application

Feb 28, 2011

I have two projects in one solution :

Class Library for my BLL and DAL classes Web Application for my PL

Now I just use the keyword "using" in the BLL and DAL classes and get access to their methods easily. but now I try to reference the BLL and DAL in the web application project through the "using" keyword but it won't let me (the name space couldn't be found (are you missing reference ?)) .. then I tried to reference the library's dll (grabbed it from the ClassLibrary/bin/debug) and the same error just popped out again!


My solution consists of two projects (ClassLibrary and a WebApplication) and I want to use/reference the classes/dlls of the class library in the web application

View 3 Replies

Access A WebMethod In Class Library?

Aug 8, 2010

I have a custom class library that performs validation. I want to open up this class for use within Javascript. I understand that I can easily achieve this by utilizing WebServices/WCF or by creating a function on my page with the WebMethod attribute, but it'd be nice not to have to set all that up for every project.

Ideally I'd like to just add the WebMethod attribute to my class library methods and then call them using Javascript.

View 2 Replies

How To Access Session Object Outside The Web Project (class Library)

Oct 29, 2010

I am implementing a custom membership and role providers where I need to store all the role/membership information in the user's session.

I am implementing these custom providers inside a class library project (different from the website project) and need to access the session in them. The idea is to store the role/membership related information in the session after retrieving them for the first time from the database.

When I try to access the Session using System.Web.HttpContext.Current.Session

I get this as a null object (Object reference not set to an instance of an object.

Why is the session turning out to be null?

View 1 Replies

WCF / ASMX :: Class Library For Service (ServiceLibrary) To Access Data Form Database?

Jan 11, 2011

I created a Class library for WCS service (MyWCFServiceLibrary) to access data form my database. The database connection strings have been defined in Properties->Settings.settings. The endpoints are defined in the app.config. Tracing and logging is set to write to files on local server. This service is hosted by a .net web service. This webservice refrences the WCF service using MyWCFServiceLibrary.dll and MyWCFServiceLibrary.pdb. The web service is hosted in IIS. All this setup is working fine on the development environment.Now I want to deploy this in the QA environment. Since I am a newbie with WCF, I would appreciate some help on what needs to be done for deploying this on the QA server.1. Do I need to recompile the MyWCFServiceLibrary.dll after changing the connectionstring to point to QA database and tracing and loggint paths to the new server?2. Is there anything that needs to be done with end points or anything else?

View 1 Replies

How To Remove Access To A Method From Parent Class

Feb 25, 2010

Do i remove the ability to call a method from the class my page is inherited from?

I am trying to build my custom Role Provider and certain method i not want to be accessible.

View 2 Replies

C# - How To Access Singleton Class's Static Method

Nov 17, 2010

I have some confusion with singleton class, below are my some points:

1.Can singleton class have static method?,if yes then how we call that methods?
2.what is main difference between Static class and Singleton Class?

I have created my singleton class as follows:


In Above class structure I have created two method one is Static and second is non static, When I am trying to access Static Method it gives me compile time error.

How can I use static method of singleton class?

View 7 Replies

Forms Data Controls :: Access A Method Of Entity Class From A FormView?

Feb 24, 2010

I have a Customer database table with a text field named customerPicture with the name of the JPG file.

I have made a Customer Entity class with the LinQ to SQL Designer.

I also have a FormView displaying Customer instance binding with a LinqDataSource.

My problem is:

I want to make some modifications when some control want to bind the customerPicture field.

For example, when my FromView want to show the field customerPicture I want to return not only the JPG file name, I want to modify this string to add the complete file path and perhaps resample the image to a determinate width and height.

I know that is posible to defeine a partial class named Customer to implement certains partial methods, like OnCustomerPictureChanged(), but I dont know how to do this.

If I make, in this Customer partial class, a new method, for example getResamplePicturePath(), how could I invoke it from a FormView?

View 10 Replies

Web Forms :: Way To Control Null When Inheriting From Class Library Class

Sep 16, 2010

I have this Control directive in a usercontrol (i've changed the namespace and class name):

<%@ Control Language="C#" AutoEventWireup="true" Inherits="Namespace.Path.To.ClassName" %>
<asp:TextBox runat="server" ID="txtComment" TextMode="MultiLine" ValidationGroup="comment" />
ClassName is a class that lives in a class library and this is the class:
namespace Namespace.Path.To
public class ClassName : System.Web.UI.UserControl
protected System.Web.UI.WebControls.TextBox txtComment;
protected void Page_Load(object sender, EventArgs e)
HttpContext.Current.Response.Write(txtComment == null);

View 3 Replies

C# - How To Show A Message Box From Inside A Class In A Class Library

Feb 24, 2010

Can anyone tell me how to show alert message inside the .cs file of class library project in c#? I am calling a method of cs file in classlibrary project. Whenever the control comes to the alert message statement inside the method, alert message should be shown on the web page(aspx) and the next statement to the alert message statement should not be executed.

View 3 Replies

C# - How To Inherit A Page Class From A Class Library

Mar 16, 2011

I might be asking a dumb question, but I have a client for whom I need to build many websites (10+) (asp.net 3.5) which will all the pages on each site will have the same codebehind, but the sites will launching in different regions and whilst following the same template, will have different content.I have built and launched site 1, and sites 2, 3 & 4 is nearly live, but it occurs to me that as all the sites are basically the same, the code is going to get more complicated to update as it will be duplicated, so if I need to do a bug fix on one site, I'll need to do the fix on all websites (and this is going to get complicated.)

I was wondering if it possible to somehow create a class library of all the current aspx.cs files, reference this dll in each website and then inherit these classes into the .aspx.cs files. So default.aspx in each site would still have a CodeFile of "Default.aspx.cs", but Default.aspx.cs would inherit the corresponing class from the dll:

using WebPagesClass;
public partial class _Default : WebPagesClass._Default
{ }

The reason for doing it like this is that if I need to change any code on a specific website (for minor changes in languages for instance), I can override the page functions and change the parts required. For all other pages which have not cha, I can just copy from a single website.Is this vaguely possible? If not anyone one got any killer suggestions of how to manage so many websites from a single codebase?

View 2 Replies

Access :: Data Access Class / Helper Class For Access Databases?

Mar 15, 2011

recommend a data access class / helper class for Access databases, similar to the sqlhelper class found in the (Data Access Application Block)?

View 6 Replies

C# - Access Master Page Public Method From User Control/class/page

Oct 25, 2010

I am to access a method on my master page. I have an error label which I want to update based on error messages I get from my site.

public string ErrorText
get { return this.infoLabel.Text; }
set { this.infoLabel.Text = value; }

How can I access this from my user control or classes that I set up?

View 3 Replies

DataSource Controls :: ObjectDataSource - Update Method To Pass Entity To The Method In BLL Class?

Oct 18, 2010

I have an ObjectDataSource that I want to perform updates using a business entity i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form viaother properties of the control):

Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating
Dim entity As New Login()
Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo)
entity = accountControl.Entity
e.InputParameters.Add("entity", entity)
End Sub

And here's the markup for the datasource:

<asp:ObjectDataSource ID="MasterDataSource" runat="server" EnableCaching="true" CacheDuration="10"
SelectMethod="SelectAll" UpdateMethod="Update" TypeName="Data.DAL.LoginDAL">

My question is, how can I get the update method to pass this entity to the update method in my BLL class? It seems the Update method requires an ID or reference to the original object to use in determining whether any changes have taken place, but I don't really want to do this. In other words, I just want to use the Update event on my ObjectDataSource to pass my entity to the method ("Update") I set as a property and then let this business method handle the update of the data. Shown below, is the BLL update method I want to call:

Public Overloads Function Update(ByVal entity As Login)
If entity Is Nothing Then
Throw New ArgumentNullException("entity")
End If
MyBase.Update("UpdateLogin", entity.Username, entity.Password, entity.FirstName, entity.LastName, entity.Role, entity.Region, _
entity.Email, entity.Title, entity.TierID, entity.Street, entity.City, entity.State, entity.Zip, entity.Mobile, entity.Phone, entity.Fax)
End Function

When I try to call this as it stands now, I get an error: ObjectDataSource 'MasterDataSource' could not find a non-generic method 'Update' that has parameters: ID, entity. Previously, I'd set up a long list of parameters of basic data types (string, int, boolean), but this is rather cumbersome and I was hoping to use an entity for this (FYI, I also got the same type of error when I tried this approach, but with the ID as the
last parameter in the list). Perhaps what I'm doing here is atypical to how the ODS is normally used?? Has anyone done something like this successfully?

View 1 Replies

Class Library Can't Be Found?

Apr 19, 2010

I have a web Application and have created a seperate class library project.I am trying to use the Class Library by referencing it in the Web Application. I am doing this by right clicking the web application and clicking 'Add Reference...'. I then browse to my Class library and click ok. This gets added to a Bin folder in my web application.The problem is I can't actually get any of the objects that are in the Clas Library. I have tried adding a using statement to the top of the page. It tells me that the object could not be found (are you missing a using directive or an assembly reference?)Can anyone tell me what I'm doing wrong?

View 3 Replies

Get A File In Class Library?

Dec 30, 2010

i have a class library that get a xml file and read it and set some property from that data

may code is like:


the problem is this code is in class library and the file is in web form application.

View 1 Replies

Use System.Web.Mvc From Class Library?

Jun 4, 2010

I'm working on an ASP.NET MVC application, but I'm trying to remove everything but Controller code from my project and put it in it's own Class Library. I've got some code that is using System.Web.Mvc; But it doesn't seem to be letting me access it. I have Referenced the System.Web Namespace in the project. Bassically I'm getting errors on the iActionFilter and the FilterAttribute stuff.

View 2 Replies

Library Using That Provides Gmail() Class?

Mar 25, 2010

What library are you using that provides your Gmail() class?At a guess I would say its out of date and its trying to query a gmail api that is returning a different data set?If you post the address of the library then we can look and see if its up to date

View 5 Replies

C# - How To Execute Base Class's Method Before Implementors's Method

May 12, 2010

I have the following page


Currently, only GenericOfflineCommentary's ExtractPageData() is firing. How can I modify this to first run OfflineFactsheetBase's ExtractPageData() and then GenericOfflineCommentary's?

edit: I'm trying to avoid having to call base.ExtractPageData() in every implementor.

View 2 Replies

How To Create A Class Library Use SQL LINQ

May 24, 2010

i want create a class Library work with SQL Linq ,when i create a LINQ Data Class it automatic create some connectionString and use the database namemy question is can i change some settings that, use this class Library in difrent website with difrent connectionStrings?

View 6 Replies

C# - Consume Web Service In App From A Class Library?

Feb 16, 2011

My team and I have a asp.net web forms application and are using several class libraries. In one of those libraries, we are trying to consume a web service. The web reference was added in the web app project and the appropriate references have been added. The app compiles. When attempting to consume said web service in the class library, the credentials don't seem to work, and the call fails. However, if we take the web service call out of the class library, and consume it within the web app, it works.

View 5 Replies

How To Use Web Class Library From A Windows Project

Feb 19, 2011

I have a Web project in which I defined some methods to parse some webpages. I then save the retrieved data in a DB. Now I have run a lengthy operation(it may take 2 days) in which I continously parse webpage this way.

Can I use the webproject from a Windows project. If I try to add a refference to it it doesn't work. How should I do it? I have used until now an asp.net application, and done the calls to the parsing methods in the pageLoad event but after an hour or so the process stops.

View 1 Replies

How To Debug The Custom Class Library

Feb 3, 2010

I have Web Service in Asp.Net Application, i create a break point in Web service. In the web service i create a instance for custom class library and call a method inside the Class library. When i run the Application i can able to debug the Web service that i create the break point, but i want to debug that custom class library code also how to deug this.

When i try to debug by add custom class library inside the current solution, but am unable to debug that custom class library code.

View 2 Replies

Page Code In Class Library

Dec 21, 2010

i create a class library and i want my code behind the page be there. in my page like login.aspx is a login control and i want to write some code for that but i got some error i don't know what i'm doing rong. the code behind in class library is:


and the codes in login.aspx page is:


after i buld the project the code behind doesn't find the MainLogin control

View 3 Replies

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