how can I use the same data source to control gridview

 I have two gridviews.

One is used to bind the data that user search by searching form.

And another one is used to show the selected data when user select in previous gridview.

When I use gridview, i bind the selected data by using the data source, ds.

and after result show back to the user, my page will disable any searching area,

and show only the button to add more items into the selected list.

My scope is... if user need to add more items into the selected list.

I will enable searching area to the user for searching it again, 

My question is.. how can i bind the selected data that user selects again

with the same query and the same data source?

 

Can I merge the result of data source together?

or, Should I check the data source which has the previous data or not before i fill in the data adapter, and then bind it?

and how can i insert the new data source into previous data source.

because i must keep both data to do something in the next page.

 

Or, anyone have another better way to suggest me?

thanks a lot for every answers.

0
mixarstudio
1/17/2009 6:53:27 AM
asp.net.object-datasource 16182 articles. 0 followers. Follow

2 Replies
734 Views

Similar Articles

[PageSpeed] 25
Get it on Google Play
Get it on Apple App Store

Just retrive the datarows from datatable in the adapter and bind the grid,

 

DataRows can be retrieved using Select Method of DataTable

 

Thanks

 

 


Thanks & Regards,
Izhar Ul Islam Khan
Microsoft Certified Technology Specialist
0
izharulislam
1/18/2009 8:34:53 AM

Hi mixarstudio,

Can I merge the result of data source together?

or, Should I check the data source which has the previous data or not before i fill in the data adapter, and then bind it?

and how can i insert the new data source into previous data source.

because i must keep both data to do something in the next page.

From your description, I think you could cache the returned data, and merge it with the new selected data in next time. In this case, you can filter data source with the total conditions. To cache the returned data, you could do it like this:

protected void ObjectDataSource2_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
    // Retrieve the returned dataset.
    DataSet ds = (DataSet)e.ReturnValue;
            
    // Cache it.
    Cache.Insert("OldFilters", ds); 
}

Then in next time, you could retrieve the old filters from cache, and merge it with the new filters.

Thanks. 


David Qian
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Wencui
1/20/2009 5:09:02 AM
Reply:

Similar Artilces:

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

How do I Data Bind a GridView Control to an object data source that has imbedded objects
What follows are snippets of two classes that I am using: public class Location{ private string locationCode;  public String LocationCode {      get { return locationCode;}      set { locationCode = value; } }} public class User{ private Location location;  public Location Location {     get { return location;}     set { location = value} }}  I have bound a GridView control to a collection of User objects.  Within the GridView I need to display the ...

how to use business entities in business logic and data access layers when object data source is used?Here is my code can somebody pls help me in using business entities to select,insert ,update and d
Hi, I am new to dot net ,can someone please help me in how to use business entites in dataccesslayer and businesslogiclayer. I should not use dataset instead i should use business entites to get all the links,I am posting my code here,i am posting my business entites and dataaccess layer and business logic layer.Also I have a question regarding event handlers ,how to use that using grid view.Please can any reply as soon as possible.Here is the code:   Business Entities:  namespace UsefulLinkEntity { public class UsefulLinkEntity {public string strdp_Title...

How can I use Authentication control if I use access data source ?
Hi ,everybody, I used access data source , How can I use Authentication control ? Thanks a lot !I'm a beginner , thanks for you help ! What do you mean by Authentication control? Are you referring to the login controls? If so, please take a look at the samples from: http://beta.asp.net/QuickStartv20/aspnet/doc/ctrlref/login/default.aspx Thanks,LauraThis posting is provided "AS IS" with no warranties, and confers no rights....

Update table data using object data source control
Hi there I am using asp.net 2.0 to update table data using the objectdata source control and binding it to the gridview. I am unable to perform the update operation. I am using a table with cat_id as identity column and cat_name.Also I am using an stored procedure to update data. here is the code snippet. App_Code QuestCategories.cs namespace NQuestCategories { public class QuestCategoriesTable { private int _catid; private string _catname = string.Empty; public int CatId { get { return this._catid; } set { ...

Insert xml data into the database using object data source and fileupload control
Hi There, I have a fileupload control which takes the xml file. I have an object datasource with an insert method. I need to insert xml data into the sql server 2005 table which has column of type xml. Can anybody please let me know how I can do that using the file upload control? FileUpload has a property called filebytes, but how can I convert filbytes (or any other property of the fileupload)  to xml data so that I can set the insert parameter of the object datasource. Thanks a lot!!  Hi,the xml data can be inserted into the table in the form of byte[]. Here is how to write...

Using "Business Objects" as a Data Source dor DataWindow.NET Objects
Hi: I have developed a "Business Object" layer which gets information from the DataBase. I would like to use these objects as a Source for the DataWindow.NET objects. It is possible? DO I have to use External Source? Some example? Thanks in Advance! Gus dw.net doesn't support this: I will be glad if someone comes up with an generic work around to bind. sybase is snoozing on this one. thanks vsv "DataWindows.NET" <gussabina@yahoo.com> wrote in message news:4740cbfa$1@forums-1-dub... > Hi: > I have developed a "Business Ob...

What's wrong with DataBind() in GridView control? The data in GridView can't be updated when the datasource have changed!
What's wrong with DataBind() in GridView control? The data in GridView can't be updated when the datasource have changed! I bind the different datasource to the Gridview when I change the node of TreeView, the GridView control always display the same data when I click different the node of TreeView control,why?but I can get the different data in GridView when I click the Button1 or Button2. //-------------------Program Code (You may save it as a ASPX file and run it)--------------------------------<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http:/...

Can a GridView be used as a Data Source?
Can a GridView be used as a data source to another GridView? Thank you No, but you can grab and use its DataSource (several controls can share a DataSource). GridView2.DataSourceID = GridView1.DataSourceID; GridView2.DataBind();  Steve Wellens My blog Is it is possible to use one DataSource for the SELECT command and a different DataSource and ConnectionString for the UPDATE command? Thank you  ...

Sorting in gridView: Can I use LINQ to call a stored procedure and still get sorting like I can with an SQL Data source to a sproc?
I have a gridView, it is populated by the results of a stored procedure. I would like to be able to sort on the columns returned. If I use an SQL Data Source control and point it to the stored procedure it will allow me to sort the columns in the gridView by enabling sorting.   However, I can not select a stored procedure using a LINQ data source.  I can call a stored procedure with LINQ and assign it to the gridView's datasource, but this won't let me enable sorting. Is there a way to call a stored procedure using a LINQ data source, so that I can enable sorting in th...

login control can i used to controll what data can user see it
i have a project with mulit company can i used login control to control what company user can see it and what user cant see it the company comes from databasethanks alot for any helphttp://www.feckra.com/blog/ first of all you should have a table in database database that contains (user_id, company_id,  password, auth_level). the auth_level can be used to grant specific content/page access to each user of each company. but, you need to override the authentication process as bellow.    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { L...

Custom Datasource Controls Vs. Object Datasource Controls
Hi folks,I am a web developer developing pages in the project. I need to integrate the front end pages with the backend API. Active directory is being used as the database system for our project. I only use the API and the methods offered by it to interact with the data.For all the operations on the data, I have methods that I can call from the API (viz. Create(), Delete(), Modify() etc.). For connecting the data to my frontend data controls (viz. GridView, DropDownList etc.) I can use Object Datasource Control. I also read some articles about Custom Datasource controls. Now, I am having a d...

Error in using Object Data Source Control
I am using object datasource with the select method with seven parameters   Design Code : <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetCustomerInformation" OldValuesParameterFormatString="" TypeName="InfiniLogic.AccountsCentre.Administration.BLL.PublishRequest"> <SelectParameters> <asp:ControlParameter Name="LiveID" ControlID="txtLiveId" PropertyName="Text" /> <asp:ControlParameter Name="ProductCode" ControlID="txtProductCode" Pr...

How to use Nested GridView+object Data Source ?
Hi,I am facing some problem with the Gridview, that is nested Gridview. well, i am using object datasource to call up the both GridView,my requirement is that,The DS that i am calling has two different fields,let me give the layout of the Gridview how does it look.Car Benz        ImageBOX              *********                  ********           &nb...

Web resources about - how can I use the same data source to control gridview - asp.net.object-datasource

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012

DotNetKicks.com - Upcoming stories
DotNetKicks.com is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 12/26/2015 7:49:37 AM