Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2003, 10:45 AM
Authorized User
 
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding datagrid programmatically at a specific pos

Hi everyone,

I have a datagrid question again. I have to insert some datagrids in the page at run time.

I generate my DataSet and bind it to my datagrid and add it as:

datagrid.DataSource = testData.Tables[0];
datagrid.DataBind();
Page.Controls.Add(datagrid);

everything works fine, except the datagrid appears at top of table. Is there a way to have it at the bottom of the page lke after the longest control.

Thanks for any help you might give me.

Sincerely,

Pankaj

 
Old October 22nd, 2003, 10:55 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Put a PlaceHolder control in your form where you want the datagrid to go, then you can just add the grid to the placeholder.controls collection.

Peter
 
Old October 22nd, 2003, 11:03 AM
Authorized User
 
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there!

Thanks for the reply. i tried it out. However, I cannot move the place holder other than the top left of my web form. Is that normal??! I would olike the grid to appear on the bottom of the page.

Thanks,
Pankaj

 
Old October 22nd, 2003, 12:41 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Did you put the placeholder in the ASPX of your form or did you add that programmatically as well? Any time you add controls programmatically to page.controls they will end up in one of two places: the beginning or the end of the form, before or after (repectively) all the other controls in the form. If you place a <asp:placeholder> in your form's html code where you want the dynamic grid to show up, then the grib will appear there.

Peter
 
Old October 23rd, 2003, 03:10 AM
Authorized User
 
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I used the design mode and added the placeholder in design view. However, I put it in a panel and it worked fine. Weird...

Thanks again,

Pankaj






Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Event Handling Programmatically Wallhood Excel VBA 2 August 30th, 2007 10:42 AM
Copy specific data in specific cells of sheet2 yogeshyl Excel VBA 1 May 14th, 2007 07:40 AM
Adding List Item Programmatically rit01 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 February 12th, 2006 04:51 PM
How To Print specific Web Control like datagrid. qadeerahmed Classic ASP Basics 0 August 15th, 2005 11:25 PM
datagrid control and specific sql where clause Krosser VB.NET 2002/2003 Basics 0 July 25th, 2003 07:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.