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: 2/27/2003 5:11:03 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 62 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
Dubbsman
Asp.Net User
Composite Control Postback issue2/27/2003 5:11:03 PM

0/0

I have a control similar to a panel control that I place a datagrid control in. When I post back the datagrid seems to lose its view state (all the records). Do I have to save the child control viewstates? The datagrid still exist on the post back but it does not seem to get it's viewstate information after a postback!


Simplified Code:
[Designer("ContentPanelDesigner")
,DefaultProperty("Title")
,ParseChildren(false)
,PersistChildren(true)
,ToolboxData("<{0}:ContentPanel runat=server></{0}:ContentPanel>")]
public class ContentPanel: WebControl, INamingContainer
{

private ArrayList parsedControls = new ArrayList();
protected override void AddParsedSubObject(object obj)
{
parsedControls.Add(obj);
}

protected override void CreateChildControls()
{
int addCounter = 0;
foreach (object o in parsedControls)
{
if (o is Control)
{
this.Controls.AddAt(addCounter,(Control)o);
addCounter++;
}
}
}

protected override void Render(HtmlTextWriter output)
{
this.RenderChildren(output);
}

public class ContentPanelDesigner : System.Web.UI.Design.ReadWriteControlDesigner
{
public ContentPanelDesigner()
{
}
}
Dubbsman
Asp.Net User
Re: Composite Control Postback issue2/27/2003 7:14:10 PM

0/0

Here is what I have come up with. I maintains the data state of the control however, when paging it will only will go forward (have no clue all of the other events appear to be working). Any clues or a better way to handle this issue?

protected override void CreateChildControls()
{
int addCounter = 0;
foreach (object o in parsedControls)
{
if (o is Control)
{
Control temp = (Control)o;
if (o is BaseDataList)
{
BaseDataList tempData = (BaseDataList)o;
if (!this.Page.IsPostBack)
{
this.ViewState.Add(this.UniqueID + ViewStateCount.ToString(),tempData.DataSource);ViewStateCount++;
}
else
{
tempData.DataSource = ViewState[this.UniqueID + ViewStateCount.ToString()];
tempData.DataBind();
}
}
this.Controls.AddAt(addCounter,temp);
addCounter++;
}
}
}

Thanks
Matt
Dubbsman
Asp.Net User
Re: Composite Control Postback issue2/28/2003 5:03:28 PM

0/0

Found the right solution on my own. In the case of panel controls youl should not impliment the INamingContainer becuse it is intended to use in the case of templated control. So I basically took a closer look at the panel control and used IAttributeAccessor just like the panel control that ships with ASP.NET. (See Below). Everthing works like its supposed to now dataset events fire and the ViewState of the innercontrols is working fine.

[Designer("ContentPanelDesigner")
,DefaultProperty("Title")
,ParseChildren(false)
,PersistChildren(true)
,ToolboxData("<{0}:ContentPanel runat=server></{0}:ContentPanel>")]
public class ContentPanel: WebControl, IAttributeAccessor
{

public void SetAttribute(String name, String value1)
{
ViewState[name] = value1;
}

public String GetAttribute(String name)
{
return (String)ViewState[name];
}

protected override void Render(HtmlTextWriter output)
{...}

}

public class ContentPanelDesigner : System.Web.UI.Design.ReadWriteControlDesigner
{

public ContentPanelDesigner() { }

}
lmponder
Asp.Net User
Re: Composite Control Postback issue8/17/2003 6:31:04 PM

0/0

I seem to have the same problem as you but I can't find the solution.

The datagrid is disappearing on the postback. It seems that I have to rebind the datagrid just to let the pager event to run which binds the data again. I am using the datagrid in a panel type webcontrol. How do I send the viewstate back to the datagrid. I tried
adding the IAttribueAccesor and the setAtt.. and the getAtt... but where are these being called?

Are you calling them in your render method??


-----------------------------------------------------------

Crack .Net Mercenary

Always 4 Hire

[email protected]
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Developing Microsoft ASP.NET Server Controls and Components Authors: Nikhil Kothari, Vandana Datye, Pages: 689, Published: 2002
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
Programming Microsoft ASP.NET Authors: Dino Esposito, Pages: 1165, Published: 2003
ASP.NET 2.0 Cookbook Authors: Michael A. Kittel, Geoffrey T. Leblond, Pages: 989, Published: 2005
ASP.NET Developer's Cookbook Authors: Steven A. Smith, Rob Howard, ASP Alliance, Pages: 456, Published: 2003
ASP.NET 2.0 MVP Hacks and Tips Authors: David Yack, Joe Mayo, Scott Hanselman, Fredrik Normén, Dan Wahlin, J. Ambrose Little, Jonathan Goodyear, Pages: 400, Published: 2006
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
MCAD Developing and Implementing Web Applications with Microsoft Visual C#(TM) . NET and Microsoft Visual Studio(R) . NET Exam Cram 2 (Exam Cram 70-315): Exam Cram 2, McAd Exam 70-315 Authors: Kirk Hausman, Amit Kalani, Ed Tittel, Pages: 600, Published: 2003
ASP.NET AJAX Programming Tricks Authors: Matthew David Ellis, Matthew Ellis, Pages: 388, Published: 2007

Web:
Composite Control Postback issue - ASP.NET Forums Re: Composite Control Postback issue. 02-27-2003, 2:14 PM. Contact ... Re: Composite Control Postback issue. 02-28-2003, 12:03 PM. Contact ...
composite controls & postback - ng.asp-net-forum.windows ... Composite Control Postback issue - ASP.NET Forums Re: Composite Control Postback issue. 02-27-2003, 2:14 PM. Contact ... Re: Composite Control Postback ...
Composite Control: Changes not being stored on postback - .NET ASP Mar 1, 2006 ... Composite Control: Changes not being stored on postback. Get answers to your questions in our .NET ASP forum.
Composite Control not firing postback : raisepostbackevent, firing ... I have a fairly simple control. It is a Label, a Textbox and a few ASP.NET Validation controls. Through setting properties on the control I ...
C# - Custom Composite Control Causes Full PostBack | DreamInCode.net C# - Custom Composite Control Causes Full PostBack. ... Post the code you are using and we will be happy to help you sort out the issue. ...
A Crash Course on ASP.NET Control Development: Building Composite ... CompositeControl to Fix Design-Time Issues .... The first control—the composite control—correctly maintains the assigned text across postback. ...
sorting composite control data on postback - ASP.NET Building Controls sorting composite control data on postback ASP.NET Building Controls. ... Nesting server controls with a composite control don't generate postback events ...
RE: Composite control, postback and change control tree Nov 4, 2005 ... Subject: Composite control, postback and change control tree | Date: Thu, 3 Nov 2005 20:59:07 -0800 | Lines: 12 ...
CompositeControl class failing to register postback Talk about CompositeControl class failing to register postback.
Composite Controls, eventhandlers and knowing which control caused ... May 14, 2005 ... controls on it that can themselves cause postbacks. What i need to do in my composite control is to determine which consituent ...




Search This Site:










how to create dynamically woriking buttons from a class ?

how to encode a query string?

onclick event on image and imagemap does not fire!

dynamic connection to database

usercontrol

formview and ajax

post form data to another site

check which button is pressed

feedback form not working in ie

camparing values to build a table not working

how to call external exe from vb.net...

why _dopostback ????

machine wide error handler

get page html code and put into string

what happened to the postback?

registration

is it obvious?? what is the best 'matrix' way to create an edit/update web form for a single record.

building a blog from the ground up

sometimes and sometimes not? this is just weird.

refresh (or) f5 problem

upload files to file system and url to database

netscape problems

user control issue

control creation

open an outlook item from a web form linkbutton

how to use asp.net c# create logon form and registration form?? thanks

how to open more than one report windows?

a question about checkbox group

which control should i use and how to display resume ?

radio button tabbing problem

  Privacy | Contact Us
All Times Are GMT