CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 5/27/2005 8:13:50 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 20 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
BillyWilly
Asp.Net User
Control derived from DataGrid = Problems5/27/2005 8:13:50 PM

0/0

Hi.

I have my project 90% working with one Major hitch - ANY help is appreciated!

In a nutshell, it's a Server control which derives directly from an ASP DataGrid.
I then add a button column, some other meaningless stuff, and autogenerate the columns from a DataReader.

The problem is, sometimes the dynamically created column shows up on the grid - sometimes not.
I have a feeling that I'm battling ViewState - but I don't know how or why - or when for that matter.

Even the slightest change in the order in whaich I call things makes a world of difference.
Can anyone see a grotesque error here?

By the way - I have the whole thing working perfectly using a UserControl - I'm just trying to move each part one by one from the UserControl into a ServerControl so I can compile the dern thing and reuse it.
Also, I use the DataGrid's native DataSource and DataBind commands with a simple DataReader - the binding works fine.

Code below:

[ToolboxData("<{0}:GridSingleLinkButton runat=serverX></{0}:GridSingleLinkButton>")]

public class GridSingleLinkButton : System.Web.UI.WebControls.DataGrid

<snip>

protected
override void OnInit(EventArgs e)

{

base.OnInit(e);

ID = "dgMain";

base.AutoGenerateColumns = true;

DataKeyField = "MyDatabaseIDField";

}

protected override void CreateChildControls()

{

ButtonColumn BC = new ButtonColumn();

Columns.Add(BC);

BC.CommandName = "SelectItem";

BC.ButtonType = ButtonColumnType.LinkButton;

BC.DataTextField = "PrimaryColumn";

base.CreateChildControls();

// NOTE!! If I call base.CreateChildControls first - other wacky things happen.
}

 

<snip>

Other code not shown down here to hook up the button column click events.  When the button column actually does show itself in the grid, this event code works every time -  flawlessly.  I can get the ID of the item clicked by using:

protected override void OnItemCommand(DataGridCommandEventArgs e)

{

if (e.CommandName == "SelectItem")

DoSomething(DataKeys[e.Item.ItemIndex].ToString());

base.OnItemCommand(e);

}

subdigital
Asp.Net User
Re: Control derived from DataGrid = Problems5/27/2005 11:55:27 PM

0/0

I am about to start making my typed datagrids, so I will be paying attention to this thread for some cautions...  anyway, shouldn't you be implementing INamingContainer?
Ben Scheirman
http://www.flux88.com
BillyWilly
Asp.Net User
Re: Control derived from DataGrid = Problems5/31/2005 12:26:16 PM

0/0

Thanks-

I'll try it - but I'm ASSuming that the DataGrid from which I inherit handles that for me - I'll check on the documentation but I believe that the Datagrid already implements INamingContainer.

Any more input will be appreciated.

- B

subdigital
Asp.Net User
Re: Control derived from DataGrid = Problems5/31/2005 7:34:21 PM

0/0

I may be wrong, but I think you have to implement it in any derived class too..  I have had viewstate problems that just went away after implementing INamingContainer on a derived class.


Ben Scheirman
http://www.flux88.com
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET Data Web Controls Kick Start: Kick Start Authors: Scott Mitchell, Pages: 432, Published: 2003
Inside ASP.NET Authors: Scott Worley, Pages: 704, Published: 2001
Programming ASP.NET: Building Web Applications and Services with ASP.NET 2.0 Authors: Jesse Liberty, Dan Hurwitz, Pages: 930, Published: 2005
Building Solutions with the Microsoft .NET Compact Framework: Architecture and Best Practices for Mobile Development Authors: Dan Fox, Jon Box, Pages: 400, Published: 2003
ASP. NET 1.0 Namespace Reference with C# Authors: Jason Bell, Pages: 960, Published: 2002
Building Web Applications with C# and .NET: A Complete Reference Authors: Dudley W. Gill, Pages: 718, Published: 2002
Beginning ASP.NET 1.0 with Visual Basic.NET: With Visual Basic .NET Authors: Chris Goode, John Kauffman, Rob Birdwell, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Ollie Cornes, Dave Sussman, Matt Butler, Gary Johnson, Chris Ullman, Ajoy Krishnamoorthy, Juan T. Llibre, Pages: 816, Published: 2002
Cobol Programming Using the .NET Framework Authors: Ron Reeves, Pages: 336, Published: 2002
Programming Data-driven Web Applications with ASP.NET Authors: Don Wolthuis, Donny Mack, Doug Seven, Pages: 704, Published: 2002

Web:
selectedindexchanged event not firing in custom control derived ... Jun 28, 2006 ... selectedindexchanged event not firing in custom control derived from datagrid. microsoft.public.dotnet.framework.aspnet.webcontrols ...
extending Datagrid - problem Talk about extending Datagrid - problem. ... First, it's probably not a good idea to name a custom control derived from Datagrid as ...
"Fixing" the ASP.NET DataGrid No problem - as any object derived from the System.Web.UI.Control class, the DataGrid sports the protected OnPreRender method, which is called before ...
Using GridView and DataGrid in custom skinnedcommmunitycontrol ... Your control is probably contained in another control derived from ContentListPage, .... The problem existed also with the Datagrid as well. ...
CodeProject: Custom DataGrid with Progress Bar control. Free ... It is a sample of how to create a custom control derived from the System. ..... I have problem with data grid, so i thought maby somebody can help me. ...
A Remedy for DataGrid Vertigo To make all this work we will override the Render (which is already done for us by default) and RenderContents methods of the DataGrid control. ...
MSDN Visual C# IDE Using datagrid on inherited form derived form Jul 22, 2008 ... I have the same problem, The datagrid is locked in the designer, ... control and dock it to fill and resize the panel in your derived form, ...
Scott on Writing Created a class that derived from DataGrid, added a BatchUpdate property, ... problems - like the click event not bubbling up - since the control isn't ...
Derive or subclass a WinForms Datagrid or other control in .NET Derive or subclass an existing Winforms Datagrid or any other control in . ... To add an icon for your derived DataGrid on the toolbox: ...
Encapsulate Silverlight (DataGrid control) with ASP.NET Controls ... I need to create a silverlight DataGrid control from ASP. ... normal controls like button and canvas, but unable to create any control derived from System. ...




Search This Site:










need help in publishing

error in creating setup

deploy selective folders from user interface checkbox screen

deploying single dll web app

how do i compile the entire website asp.net 2.0 into a single assembly?

source code issue in deployment

msbuid using msbuild community tasks : - zip task fails

renaming server ( i think) to get app to run on production site

web application project problem

teambuild to deploy deployment project website to remote server

web deployment project with custom configuration

ui in web deployment projects

using host headers with web deployment projects

merging not working

web deployment. rename directory and file. is this possible?

which application to choose in the add project output in web setup project !

setting web deployment properties from custom config file and beforebuild target not firing

building web deployment project: error building resolvevcprojectreferences.

replacing encrypted connection string

is webdeploymentproject needed anymore?

deploying web services

pdb files in release configuration

bug: rdlc gets coverted to 1k file after deployment through wdp

web deployment of a web application:why the vbproj file is in the web deployment folder

msbuild task for web deployment?

to use config section replacement, custom section must inherit from...?

vs2008 + wap + wdp + seperate assembly for each page. too hard...

web deployment project always builds

help me in my problem

app_offline.htm support?

  Privacy | Contact Us
All Times Are GMT