Two gridviews for two different queries at the same time

I am doing a project a Online Flight Reservation System.The condition for data selection through queries is that: when the user selects for One-Way trip then only the first gridview will show the flights from departure station to destination station but if the user selects for the Round-Trip then I want to display the flights from departure station to destination station in GridView1 and the return flights in GridView2.What should I do for this ? Do I have to use more than one DataSets for individual GridView Contols, each dataset containing different queries Or I need to combine both the conditions for outward and return flights in one single query ? Please provide a code snippet if you can.

0
Suchi
6/21/2008 10:11:56 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1232 Views

Similar Articles

[PageSpeed] 16

Here your DataBasic Logic Involves.. Definitely you will be having one column through which you can filter Return Flights and departure flights. if user selects Round Trip then you can call your only one function Twice. i mean to Say

Suppose you have function  in your DB logic Class

public static DataTable GetFlights(int direction) //Here direction would be 1 or 0 representing Return Flights or Departure Flights

{

       //Pass direction to your stored procedure in select statement      

       return DataTable

}

and in your page Behind Code you can call it as:

GridView1.DataSource = DbLogic.GetFlights(1); //For Return Flights

GridView1.DataBind();

GridView2.DataSource = DbLogic.GetFlights(0); //For DepartureFlights

GridView2.DataBind();

Hope logic is clear.


Please Click “Mark as Answer” on the post that helps you.Thank you!

Regards:
Muhammad Jassim Munir
Islam is BEST
0
jassimmunir
6/21/2008 5:13:12 PM

Hi,

What I suggest you can do, if you do not want to change your stored procedure or use two datasets.

Use a general stored procedure to get both the data for arrival as well as departure flight.

Create a datable as:-

dt = new Datatable() as dataset;

Datatable.Filter(source like 'SouceName');

Now for one way u can use above filter.

For round trip use filter (source like 'SourceName' or 'DestinationName').

and bind the datatable to the gridview.

0
Varun
6/21/2008 5:24:54 PM
Reply:

Similar Artilces:

how to run two different query at the same time and save result to two different dataset
im using asp.net 2.0 application , and my application interfaces with SQL database. is it possible to run two SQL query and save result of query to two different datset if so , please let me know how to do that, show me the solution thanku maxmax you cant run 2 at the same time (i dont think) but you can run one after the other and save the results to two different data sets. just create a connection issue statement1 and save to dataset issue statement2 and save to dataset 2 close connection thats it. hth, mcm You can have 2 or more SQL queries in the same stored procedure....

Time difference between two time in vb .net
Hi friends, I need to calculate the time difference between two time: eg: 11:56:00PM and 12:12:00 Am ouput is 16 minutes. Can any one give me the code for it. Thanks, venkat..    http://www.google.com/search?source=ig&hl=en&rlz=&q=vb.net+time+difference&aq=0&oq=vb.net+time+   venkatramcse:I need to calculate the time difference between two time: eg: 11:56:00PM and 12:12:00 Am ouput is 16 minutes. Can any one give me the code for it. Here's an example:C#  DateTime dFrom; DateTime dTo; ...

How to get data from two different tables for two different columns of a gridview based on datakey
Hi All,            I have a Gridview with two different columns- "Faculty" coming from tblFaculty and "Teachers" coming from tblFacultyTeacherLink. I want to get data for "Teachers" by comparing FcaultyId in tblFacultyTeacherLink and then getting Teachers name. How to achieve this without using nested gridviews?  My .aspx Page is as-   <asp:GridView ID="gviewFaculty" DataKeyNames="FacultyId" AutoGenerateColumns="false" runat="server" Width="100%&q...

Two dropdownlist control two gridview problem
Hi,  I have two dropdownlist and two gridview:gridview1 control by dropdownlist1, dropdownlist1 bind to sqldatasource1 (e.g. category table)gridview2 control by dropdownlist2, dropdownlist2 bind to sqldatasource2 (e.g. author table)i add the dummy record on database table so that dropdownlist will show "--choose one" and the two gridview will display nothing. (that is what i expect, it is normal)I would like user to choose either by category(Dropdownlist1) or by author(Dropdownlist2) when they search the book table.The problem is not a critical, but when it load the page,...

how do i link two different sitemap with the use of menu control in one .aspx file to two different hyperlink in the master page?
I have two menu control with similar file(eg.defect.aspx) in the master page, whenever i click the similar file(eg.defect.aspx) in either menu control, it will show both the menu control(eg.student menu and staff menu), but i only want to show only either one of the menu (eg,student menu only). Is there any solution to my problem? Am i able to use similar file(eg.defect.aspx) for two different sitemap and two menu control and only show one menu control. Hey, What should or should not be visible; the whole menu, or the selected field?  Are you h...

printing two datawindows at the same time in two different printers
how could i print two datawindows at the same time in two different printers?? Yes you can but you print first dw and then change printer and print other. There are post on this newsgroup how to dynamically change printer (during program execution). Regards, Mile Kragulj kmile@kisistemi.com <judith> wrote in message news:14C3A52879147F610020A74185256BA4.0020A75E85256BA4@webforums... > how could i print two datawindows at the same time in two different > printers?? Are you in PB8? If so, all you have to do is dw_1.Modify('datawindow.printer=xxxx'...

binding two tables in dataset to two gridview controls
 HiThanks for your time.here is my question.I have a storedprocedure which gives 2 tables output.now i have those two tables in dataset. my question ishow to assign firsttable in dataset to gridview1 and the second table to gridview2.i.e is there a way i can name the two tables in the dataset.by using the names of tables in dataset can i assign them to gridview's if so please give me the sample code for that.your help is appreciated.     HiYes, you can do that. Here is an example.//dataset containing tables.  DataSet ds = new DataSet();//Binding Table...

Master Details in two seperate GridView Controls
I am simply trying to have a list of people in the top grid control (works fine), then when selected have the second Grid Control show details for that person(not working). Here is what I am trying from the load event: Sub BindData() Dim myConnection As New MySql.Data.MySqlClient.MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionSql")) Dim strPersonSQL, strActSQL As String strPersonSQL = "select row_id, first_name, last_name, middle_initial, dsi_id, created, created_by, program_of_study, email from tbl_person" Dim myPerCommand As New MySqlClient.MySqlComm...

Two Queries from Two different Databases = ONE Display/Table
What is the best approach to handle this situation?  I have three different databases, which has it's own stored procedure.  I need to call them all at page load and piece together the data.  The common demoninator is the date.  2007 JAN FEB MAR APR row 1 50 60 89 63 row 2 44 21 62 46 2006 JAN FEB MAR APR row 1 60 90 65 41 row2 984 650 452 762 Row 1 and Row 2 come from two different databases and stored procedures.  How can I query the data and present it as it's shown above? Thank you!  &qu...

time difference between two times.
hi, I wanted to find the time difference between the current time in getdatetime() and the time stored in variable. i.e., declare @time varchar(100) declare @currenttime datetime set @time=10:10:10 am (hh:mm:ss am/pm) format -- ( since this value is stored as varchar in table, here also i m using the same type) set @currenttime--- (get server time) @time-@currenttime --- ? how to find this result????         We have a function which will returns the date & time in required format. CREATE FUNCTION [dbo].[ufsFormat] ( @Date ...

testing two three two three two two
Test ...

Any difference between two control classes in net 2005
I have a problem with net 2005, i have two controls having the same namespace (namespace is: Controls), the first control class's name is 'Controls_ToolBar', and the second control class's name is 'Controls_ToolBarSeparator'. In the first class, i declare a variable which points to the second class, but it give error. Following is my code:First control class:Namespace Controls   Public Class Controls_ToolBar      Inherits Controls.ControlBase      Private lastLabel As Controls.Controls_ToolBarSeparator = Noth...

Combining two different datasoruces from two different servers?
Hi I'm triying to combine two different sql datasoruces which are from two different sql servers. But I can't seem to get it work I would appreciate any help you guys can provide. Here is my code so far. Dim PCconnectionString As String = ConfigurationManager.ConnectionStrings("CenterConnectionString").ConnectionStringDim TCconnectionString As String = ConfigurationManager.ConnectionStrings("CoreConnectionString").ConnectionString Dim PCcon As SqlConnection = New SqlConnection(PCconnectionString)Dim TCcon As SqlConnection = New SqlConnection(TCconnectionString) Dim sqlPC As String = "S...

two menu controls required in one aspx page with two different sitemap file
dears,in vs2005 website how it is possible to add two menus with two different sitemaps ??...here i did one menu control like as follows...now this menu is working fine with SiteMapDataSource1  and web.sitemap.now my requirement is i want to add one more menu control with another sitemap file...is it possible to do that way?can anybody help me for this? <asp:Menu ID="Menu1" runat="server" BackColor="Green" BorderColor="Green" BorderStyle="Ridge"              &...

Web resources about - Two gridviews for two different queries at the same time - asp.net.presentation-controls

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/11/2015 7:09:31 PM