Retrieve Data from two tables columns in one DataList Control!!!


 There is a DataList Control to retrive Data from Database Table.

I want to retrieve data from two tables columns in one DataList. How can i?


Thanks in Advance

Asghar Ali Mohammed
(Web Designer and Developer)

Do not forget to "MARK AS ANSWER" on the post that helped you.
6/26/2008 1:47:24 PM 72751 articles. 3 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 45

 Can you give an example of what you want to achieve?


Dont forget to click "Mark as Answer" on the post that helped you.
6/26/2008 2:01:38 PM


SqlConnection myConnection = new SqlConnection("Your connectionString");

SqlDataAdapter ad = new SqlDataAdapter("SPNAME", myConnection);

DataSet ds = new DataSet();


GridView1.DataSource = ds.Tables["Table1"];


GridView2.DataSource = ds.Tables["Table2"];

"A conclusion is where you got tired of thinking.
Be different. Think "

Remember to click “Mark as Answer” on the post If you get answer from my post(s) !

Thanks Guys
6/26/2008 2:05:34 PM



I'm not using code Behind. Is there a way in SqlDataSource Select Command?



Asghar Ali Mohammed
(Web Designer and Developer)

Do not forget to "MARK AS ANSWER" on the post that helped you.
6/26/2008 2:14:44 PM



I got it by adding "INNER JOIN" in select command.


Example: there are two tables table1 and table2.

in select command "SELECT table1.News_Id, table2.Product_Id from (table1 INNER JOIN table2 ON table1.News_Id=table2.Product_Id)" 


Thats it.


Asghar Ali Mohammed
(Web Designer and Developer)

Do not forget to "MARK AS ANSWER" on the post that helped you.
6/26/2008 5:07:15 PM

Similar Artilces:

Problem in retrieving data from two table when one column entry in each table are same but no column in these table match with each other
Hello there!,       First of all i have two tables . one acts as a master table and other one acts as a details table. Currently the ptoblem with my procedure is, i have entered two entries for one project in the Master table. and to briefly discribe those two entries in the master table , i have entered two entries in the Details table corresponding to the entries in the master table. Now i need to combine the master table entries and the details table entries for the same project which should give only two entreies. but my procedure gives four entries. Could yo...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

How to add the data present in the controls to a table control without any database involvement.
Hi All,i am four controls where i will write the text and once i click the add button those should get added to the table .i want 6 columns fixed in the table and rows as many as required.i tried doing that taking a table server control and able to load the table.but the problem is whenver i am adding a new row the old one is gfetting overwritten by this and at the end i am getting only one row.  System.Web.UI.WebControls.Table t1 = new System.Web.UI.WebControls.Table();  i have declared the below one global TableRow tr; TableCell tc1; TableCell tc2; TableCell tc...

Bind Data to an Image Control not in a Data Presentation Control
I've been searching for two days but I don't really know what to search for.I'm making a site for a photographer.  The Default.aspx page displays Albums by showing a title, image and description from the database table Albums. Click an album to view the contents and it passes the QueryString which is AlbumName.  The ViewAlbum.aspx page uses the QueryString to display an UpdatePanel holding a Large Image and a Repeater full of dynamically filled ImageButtons for thumbs.  Both are from the database table Photos and are retrieved using an ObjectDataSource. Click the ...

How do I control one control from another control?
I have a page page1.aspx which is within a master page. On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed. Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all. Is there a good article or someplace I can find some information on how to do this? Information Technolo...

Selecting from two tables with different data
Hello!I have two tables:Pressreleases:| Pressrelease_ID | PressDate | FilePath | Title |PressLinks:| PressLink_ID | PressLinkDate | PressLinkUrl | PressText |I would like to select the the TOP 3 with the most recent dates from either Pressreleases or PressLinks, and present them in a DataList. How do I do that? Selecting from one table is no problem:SELECT TOP 3 Pressreleases.PressDate, Pressreleases.Filepath, PressReleases.Title FROM Pressreleases ORDER BY PressDate DESCHow do I select from both tables and rename the columns to Date, Path, Text so that I can us...

masterpage and control formatting (table control, HTML table control)
I have a master page that contains 1 contentplaceholder.  In my default.aspx (that uses the masterpage layout) I have a table server control.  During page_load I get the data I need and repeatedly add the usercontrol to the table control, one user control per row.  My user control is basically a HTML table with several rows and columns that's populated with data upon creation. I want this table to fill the contentplaceholder's width. In addition within the masterpage I have a CSS link for my stylesheet. Here are my questions: Is there a better way of adding ...

ajax control in data presentation controls
can i add ajax controls (MaskedEdit) to presentation controls (dataGrid, dataForm)?? Hi,of course. But keep in mind that those controls are extenders, so you append them to an existing control. Just convert your GridView / DetailsView-fields into templated fields and add the extender you'd like to use to the controls.RegardsMarco Buerckel Don't forget to mark posts that were helpful as answers. Actually, if you looked at the source code for the Masked Edit Extender, you'd see  [TargetControlType(typeof(TextBox))]Meaning, targeting any control type other than textboxes...

Controlling table tags in datalist control
Is there any way to control the table tags (for instance, adding a class to the <table...> tag and/or <td...> tags?  TIA,Owen <%-- for the <table> tag (use CssClass) --%> <asp:DataList runat="server" ID="DataList1" CssClass="yourTableClassName" ... > <%-- and for the <td> tag --%> <ItemStyle CssClass="yourRowClassName" /> </asp:DataList>  ...

data presentation controls (how to call the individual controls)
Hi please help me.,i have this question., example i create a site with one control, like textbox. when i double click on the white page, the page load event, in the intellisense, the textbox is visible, but when a formview with a textbox inside, in the same page load event, intellisense, the textbox is not available. how can i do the simple intellisense calling where the textbox is just outside a data presentation control like formview. i mean by this intellisense calling is in VB code view., thanks JFRBPH12™  The textbox is within the formview then you can find it like this...

want to call one function in one user control from another user control
hi i have two user controls info.ascx and personal.ascx i have a function like in info.ascx i have a function like showdetails() {   } now i want to access this function from personal.ascx can i do this ? thanks in advance. shwetaThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path  you should better create a class where you will define the "functions" that you need in both files. declare "static" the function and call it like nameofclass.nameoffunction In a web project you can...

Is it possible to limit the items in a dataList control to two columns and two rows?
or with sql?   to have less columns select less field to have less row use the top function. I really suggest you do not use * to get all fields its longer and normally you do not need all tables fieldDo not forget to mark as answer all message who help you.Don't forget to check if you can answer some of our question to. sorted thanks...

Help with dynamic controls and retrieving data from dynamic controls
I am new to web development. My requirement is Text boxes get generated dynamically based on user input on click of a button called Ok after user enters values to these textboxes when user clicks on submit button ,values user entered to these textboxes have to be retrieved for further calculation I am generating text boxes in the ok button click event how to retrieve value user enters to these n where the procedure for that to be placed here u need to give name to id of every texbox in a specugic patterns so than u can know next time.   static int i = 0;protected...

Two controls on one page updating values on controls
I have two user controls on an aspx page.  Control 1 is view. Control2 is search.  User selects value on Control2 and I want to update Control1(View).  I cannot find syntax to change values on Control1 from Control2.  The following is function on Control1 that is called from Control2 after pageInit and load on Control1.  I have tried many many ways to findControl but all fail. 'Function on Control1 called from Control2 after Control1 PageInit/load:         Public F...

Web resources about - Retrieve Data from two tables columns in one DataList Control!!! -

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Out-of-control car hits Ballajura pedestrians and puts four teens in hospital
Four teenagers were injured in Ballajura on Saturday night when an out-of-control car careered into them.

Obama calls for better gun control, and for tech companies to help fight terrorism
President Barack Obama all but called out encryption in a 15-minute Address to the Nation speech on Sunday night. The President touched on various ...

Chris Christie: NYT gun control op-ed "liberal claptrap"
N.J. governor and GOP presidential candidate tells "Face the Nation" stricter gun laws won't "stop terrorists from attacking us"

Porsche To Mission E Control: We Are Clear For Launch!
... handling of a Porsche. The contrast seemed to start early cries of the Mission E being the next Tesla [&hellip Porsche To Mission E Control: ...

EU could soon have border controls
EU ministers have agreed to press ahead with plans to suspend the Schengen passport-free travel zone, the FT reports.

Windows 10 vs. OS X: Which gives sys admins more control?
Nearly everything can be managed as if it were a mobile device, using APIs at the operating system for assured reach and consistent implementation ...

Erick Erickson Typifies Conservative Insanity On Gun Control
Even though America is averaging one mass shooting a day, and no matter how many Americans get massacred by automatic weapons, conservatives ...

Attorney General Says Obama Could Call For Congressional Action For More Gun Control
Attorney General Says Obama Could Call For Congressional Action For More Gun Control

San Bernardino Shooting: National Rifle Association rubbishes Obama's gun-control appeal
San Bernardino Shooting: National Rifle Association rubbishes Obama's gun-control appeal - Hitting out at Barack Obama for politicising the incident, ...

Resources last updated: 12/7/2015 5:53:50 PM