DataSource Controls :: How To Pass An Object To The Selectmethod Of The Objectdatasource Control

Mar 31, 2011

how to pass an object to the selectmethod of the objectdatasource control?

View 2 Replies


Similar Messages:

DataSource Controls :: Pass Parameters To The Selectmethod Property Of The Objectdatasource Control

Mar 27, 2011

how to pass parameters to the selectmethod property of the objectdatasource control.

View 1 Replies

DataSource Controls :: Specify Two Different Methods As SelectMethod Of ObjectDataSource At Two Different Events?

Apr 13, 2010

Can we specify two different methods as SelectMethod of ObjectDataSource at two different events?

I need my Objectdatasource to get filled with one method while at button click event I want to fill it with other overloaded method.

Both the methods have same name and return same data type but they have different input parameters.

View 6 Replies

Accessing An Object That Implements SelectMethod For ObjectDataSource?

Nov 8, 2010

Is it possible to access an object that is used by ObjectDataSource to retrieve records? For example,

<asp:ObjectDataSource ID="MyDS" runat="server"
SelectMethod="getUsers"
TypeName="DataSources.UserDS"
SelectCountMethod = "getUserNum"/>... </asp:ObjectDataSource>

UserDS class has getUsers that returns DataTable and getUserNum that returns int, this part works as it's supposed. But I wonder if can access the instance of UserDS somehow (not underlying DataTable)?

View 1 Replies

DataSource Controls :: Pass Object As SessionParameter In ObjectDataSource?

Dec 28, 2010

Is it possible to pass a domain object as session parameter in an ObjectDataSource. I'm doing this:

<asp:ObjectDataSource ID="ParticipantsDataSource" runat="server" OnInit="SqlDataSource_Load"
SelectMethod="LoadParticipants" TypeName="SB.Web.units.Players">
<SelectParameters>
<asp:SessionParameter Name="user" SessionField="User" Type="SB.BusinessLogic.DomainEntity.User" />
</SelectParameters>
</asp:ObjectDataSource>

But I get the error message that I can't create an object of the type System.TypeCode from the string containing SB.BusinessLogic.DomainEntity.User for the property Type.

View 1 Replies

DataSource Controls :: Pass Id To ObjectDataSource From DetailsView Control?

Oct 25, 2010

I have an objectDataSource to retrieve data and fill a listBox on edit

I created a BLL method to get the data and set the controlId to the detailsVeiw control but the id is not passed throuh to the bll class

this is my code:

[Code]....

View 1 Replies

C# - How To Use Global Variables In ObjectDataSource.SelectMethod

Sep 10, 2010

I'm using ListView + DataPager + ObjectDataSource mix.

In the implementation of my SelectMethod of an ObjectDataSource I'd like to access a global variable set in the PageLoad() event (the method will return just the proper number of items per page). Although the variable is initialized in PageLoad() it appears to be null in SelectMethod. How can I change that?

[Code]....

View 4 Replies

Forms Data Controls :: Pass Parameter To Object Datasource In User Control?

Jun 30, 2010

I have a gridview inside a user control bind to an object datasource. Now I want to bind the object datasource with a parameter from parent page.

For this purpose I defined a public property in user control but how do I pass it with object datasource ?

I am calling from parent page like

myusercontrol.parameter=querystring["id"];

How to bind object datasource with my parameter ?

View 4 Replies

DataSource Controls :: How To Pass Variable To ObjectDataSource

Sep 10, 2010

I have an objectDataSource which uses my stored procedure GetNotifications

And my GridView is bound to that objectDataSource

the only problem is that my stored procedure requires the variable @UserName and then returns the values for that username, but I do not know how to pass the variable to the objectDataSource, does anyone know the code for this?

I can get userName from HttpContext.Current.User.Identity.Name but how do I pass that to the objectDataSource?

View 7 Replies

DataSource Controls :: Objectdatasource With A Generic Select Method - How To Pass The Type

Mar 14, 2011

[Code]....

[Code]....

The GetList method is as folllowing:

[Code]....

Now i can populate my gridview trough code by this: //gvwDiensten.DataSource = new BindingList<diensten>(dataManager.GetList<diensten>().ToList());But i would like to use an objectdatasource, so i created this:

[Code]....

</asp:ObjectDataSource>

But when running the page i get:

ObjectDataSource 'dsDiensten' could not find a non-generic method 'GetList' that has no parameters.

View 5 Replies

DataSource Controls :: Objectdatasource Return Inserted Object Like LinqDatasource Do?

Mar 5, 2010

I would like the ObjectDatasource insert and update data methods to return the inserted or updated object like LinqDataSource do.

View 2 Replies

DataSource Controls :: Passing Object To ObjectDataSource.SelectParameters Collection

Mar 30, 2010

I'm trying to use an ObjectDataSource's SelectMethod() to retrieve a result set from a sql server database to populate a data table with various stored procs that have any given number of parameters. My approach is to pass an object which contains the stored proc name and information about its parameters into the SelectMethod(). My issue is that I don't know how to actually set the default value. Here is the code I have so far:

ObjectDataSource1.DataObjectTypeName = "WebApplication1.Children";
ObjectDataSource1.TypeName = "WebApplication1.Children";
ObjectDataSource1.SelectMethod = "Select";

Parameter odsParameter = new Parameter() { Name = "storedProc", Type = TypeCode.Object };

// How do you set the default value to reference an object?

ObjectDataSource1.SelectParameters.Add(odsParameter);

namespace WebApplication1
{
public class Children
{
public DataTable Select(object storedProc)
{
// do stuff here and get db values.
}
}
}

The default value of a Parameter object is a string type. Does anyone know how to set the default value with an object or how I can pass an object into the SelectMethod?

View 2 Replies

DataSource Controls :: Make ObjectDataSource Typename Of A Singleton Business Object?

Mar 14, 2010

How do I make ObjectDataSource work with singleton Business object? My singleton business object is defined in Global:

[Code]....

I get an error:The type specified in the TypeName property of ObjectDataSource 'objThreads' could not be found.

View 2 Replies

SelectMethod In ObjectDatasource Getting Called Multiple Times With Multiple Datapagerfield?

Oct 7, 2010

so here is the setup. I am building a page that has a listview, a datapager, and 3 datapagerfield (2 x NextPreviousPagerField, 1 x NumericPagerField), and a objectdatasource to tide all of this together.

It was all working fine until I put a breakpoint into the SelectMethod specified in the objectdatsource control. It seems like that for each datapagerfield control, it is calling the selectmethod and selectcount method. Hence, whenever a user paged, it calls the database 6 times instead of 2 (I don't have caching turned on atm). If I remove one datapagerfield, it will remove 2 calls.

Now this is build in asp.net 3.5 SP1 in VS2008. When I copied the same code files to a asp.net 4.0 VS2010 solution, it duplicate call seems to be gone.

Is this a bug in asp.net 3.5 SP1?

View 1 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">
</asp:ObjectDataSource>

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

DataSource Controls :: Paging With Repeater Control Binded With Objectdatasource?

Jan 28, 2011

I want to do pagination in repeater control.

I am using repeater.Datasource = objectDataSource.

and objectdatasource is having generic list data.

When i try to cast objectdatasource to dataview ...i am getting exception saying "casting

Collections Generic List cannot be casted to Dataview".

Can anyone tell me easy way to do Repeater Pagination in the above mentioned case

View 4 Replies

DataSource Controls :: Link 2 Objectdatasource Together Using The Control Parameter Source?

Jun 30, 2010

I'm trying to link 2 objectdatasource together using the Control Parameter Source.However, I'm stuck at the screenshot below. The Next button is disabled.

View 1 Replies

DataSource Controls :: How To Pass The Array ( Object[]) Or Structure Data Type Value To The Store Procedure

May 6, 2010

I want to pass the Array ( object[]) or Structure data type value to the store procedure through
ibatis .net. I can do same by commandtext using SQLDBType.Structure. I am using Table value function in sql server 2008 and .Net 2010.

[URL]

View 2 Replies

DataSource Controls :: Control This Objectdatasource Programatically From The Code Behind Based On Different Button Clicks?

Sep 2, 2010

I have a page where you can search and display other data, very simple layout. 1 Gridview and 1 objectdatasource. But i have 4 possible buttons that can populate the gridview..

i would like to control my objectdatasource from the code behind based on the button you click.

here is what i have right now.. but if possible, can this source not be hardcoded like this and only built in the code behind?

[Code]....

I found this site with a solution to this persons issue, but i cant seem to get mine working this way.

http://stackoverflow.com/questions/2404264/overwriting-controlparameters-of-datasources-in-code-behind

I have this as the code behind right now when you press the button.. what other parameter settings am i missing and is this the right order to populate them for the source to acknowledge my values?

[Code]....

View 8 Replies

DataSource Controls :: Pass Value To SqlDataSource Control With StoredProc?

Apr 22, 2010

i have a website with a gridview, i bind the SqlDataSource Control that i use for my Gridview with a StroredProc. but the storedproc has to get a value which is from a textbox so that the gridview can display a record.

View 3 Replies

How To Get The Inserted Id Or Object After An Insert With The FormView/ObjectDataSource Controls

Feb 22, 2010

I have a series of classes that loosely fit the following pattern:

public class CustomerInfo {
public int Id {get; set;}
public string Name {get; set;}
public class CustomerTable {
public bool Insert(CustomerInfo info) { /*...*/ }
[code]...

View 1 Replies

How To Use A Viewstate'd Object As A Datasource For Controls On User Control

Dec 29, 2010

I've got a listview on a control. Each row comprises a checkbox and another listview.

The outer listview is bound to a property on the control (via a method call, can't set a property as a SelectMethod on an ObjectDataSource it would appear) which is lazy loaded suchly:

[Code]....


The reason for the use of viewstate is this:

When an one of the checkboxes on one of the outer list view rows is checked or unchecked I want to modify the object that the ODS represents (for example I'll add a couple of Charge objects to the relevant Product object) and then rebind.

The problem I'm getting is that after every postback (specifically after checking or unchecking one of the rows' checkbox) my viewstate is empty. Thiss means that any changes I make to my viewstate'd object is lost.

Now, I've worked out (after much googling and reading, amongst many others, Scott Mitchel's excellent bit on ViewState) that during initial databinding IsTrackingViewState is set to false. That means, I think, that assigning the return from GetWebServiceProductLineChargeDetails() to the ViewState item in my Property Get during the initial databind won't work.

Mind you, even when the IsTrackingViewState is true and I call the Property Get, come the next postback, the viewstate is empty.

how I keep the object referenced by the ObjectDataSource in ViewState between postbacks and update it and get those changes to stay in ViewState?

View 1 Replies

Forms Data Controls :: ObjectDataSource For GridView Is Not Creating Original_{0} And New Values Object?

Mar 9, 2010

I am trying to update record in gridview using ObjectDataSource (with conflict detection)The following is the ObjectDataSource

[Code]....

Update Method is as follows

[Code]....

In ObjectDataSourceProducts_Updating(..) event , I am checking objects which are being sent to UpdateProduct(..) method. I found that both the objects " original_ProductDB and productDB " have the same the values. When I click "Update" in GridView after entering new value, ObjectDataSource is not picking new value

[Code]....

GridView is as follows.

[Code]....

ProductBO is as follows

[Code]....

View 3 Replies

DataSource Controls :: ObjectDatasource And Class As Datasource

Jun 24, 2010

I am really having a hard time trying to write something from scratch I created a 'Person' Class.Public Class Person

Private _FirstName As String = ""
Private _LastName As String = ""
Private _Age As Integer = 0
Public Sub New(ByVal FirstName As String, ByVal LastName As String, ByVal Age As Integer)
FirstName = FirstName
_LastName = LastName
_Age = Age
[code]...

View 1 Replies

DataSource Controls :: Objectdatasource Does Not Run?

Jan 26, 2010

I have set the objectdatasource in the web form. Does I need to check anything as I find that method "objProductSuppliment_Inserted" does not run??

-----------------------------------------------------------------------------------------------------------

<asp:ObjectDataSource ID="objProductSuppliment" runat="server"
OnInserted="objProductSuppliment_Inserted"
TypeName="BLL.WMS.ProductSuppliment"

[code]...

View 6 Replies







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