CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 3/22/2004 3:07:56 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 24 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
PimpoDiabolo
Asp.Net User
Dynamic Control3/22/2004 3:07:56 PM

0/0

Hi,

I want to build a dynamic control. It should be able to display a Hashtable. Therefore I thought it would be a good idea to build a basic control (myBasicControl), that displays the key of a Hashtable entry in a Labelcontrol and the value in a TextBox. Depending on the length of the Hashtable, another Control (myContainerControl) should dynamically add basiccontrols to itself. So far everything worked fine. The problems occurred when I tried to read the values of the basiccontrols a tried to handle Postback. At first I thought, I could access them via Page. Controls etc. but this didn?t work! Has anyone a solution for my problem?


Thanks,

Klaus
master4eva
Asp.Net User
Re: Dynamic Control3/22/2004 5:14:40 PM

0/0

:: I tried to read the values of the basiccontrols a tried to handle Postback

Could you post up your code for the above function/features?
-- Justin Lovell
PimpoDiabolo
Asp.Net User
Re: Dynamic Control3/23/2004 11:22:16 AM

0/0

-----------------------------------------------------------------------------------------------
The Basic Control


using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections.Specialized;

namespace test_custom_control
{
/// <summary>
/// Summary description for XmlLeaveViewer.
/// </summary>

public class XmlLeaveViewer : System.Web.UI.WebControls.WebControl, IPostBackDataHandler
{
private TextBox PCDATABox;
private Label TagLabel;
private string _tagName;
private string _pcdata;


[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string TagType
{
get
{
return _tagName;
}

set
{
_tagName = value;
}
}

public string PCDATA
{
get
{
return _pcdata;
}

set
{
_pcdata = value;
}
}


protected override void CreateChildControls()
{
TagLabel = new Label();
TagLabel.Text = _tagName;
Controls.Add(TagLabel);

PCDATABox = new TextBox();
PCDATABox.Text = _pcdata;
Controls.Add(PCDATABox);
}

/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
///


protected override void Render(HtmlTextWriter output)
{
output.Write("<table><tr><td>");
TagLabel.RenderControl(output);
output.Write("</td><td>");
PCDATABox.RenderControl(output);
output.Write("</td></tr></table><BR>");
}
#region IPostBackDataHandler Members

public void RaisePostDataChangedEvent()
{

}

public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
{
_pcdata = postCollection[postDataKey];
return false;
}

#endregion
}
}


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

The Main Control

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections;
using System.Collections.Specialized;

namespace test_custom_control
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class XmlNodeViewer : System.Web.UI.WebControls.WebControl
{
private string _nodeName;
private Hashtable _leaves;

// The porperties
public Hashtable Leaves
{
get{ return _leaves;}
set{ _leaves=value;}
}


public string NodeName
{
get
{
return _nodeName;
}

set
{
_nodeName = value;
}
}



protected override void CreateChildControls()
{

XmlLeaveViewer myViewer;


foreach (DictionaryEntry myDE in _leaves)
{


myViewer = new XmlLeaveViewer();
myViewer.TagType = (string)myDE.Key;
myViewer.PCDATA = (string)myDE.Value;
Controls.Add(myViewer);
_leaveControls.Add(myViewer);

}

}


}
}

master4eva
Asp.Net User
Re: Dynamic Control3/23/2004 1:00:02 PM

0/0

Just as what I suspected. What you are doing is calling data binding and you are using it a bit too loose in certain ways. You will need to move some of the code around but you might want to read this article:

http://aspalliance.com/391
-- Justin Lovell
PimpoDiabolo
Asp.Net User
Re: Dynamic Control3/24/2004 9:04:55 AM

0/0

Hi,

ok i have made some changes to my code, but the control still doesn´t remember the values I entered. Here is my code:

public class XmlLeaveViewer : System.Web.UI.WebControls.WebControl, IPostBackDataHandler
{
private TextBox PCDATABox;
private Label TagLabel;


[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string TagType
{
get
{ if (ViewState["TagType"] != null)
return (string)ViewState["TagType"];
//else
return "No Tag";
}

set
{
ViewState["TagType"]= value;
}
}

public string PCDATA
{
get
{
if (ViewState["PCDATA"] != null)
return (string)ViewState["PCDATA"];
//else
return "No PCDATA";
}

set
{
ViewState["PCDATA"]= value;
}
}


protected override void CreateChildControls()
{
TagLabel = new Label();
TagLabel.Text = TagType;
Controls.Add(TagLabel);

PCDATABox = new TextBox();
PCDATABox.Text = PCDATA;
Controls.Add(PCDATABox);
}


public void RaisePostDataChangedEvent()
{

}

public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
{
PCDATA = postCollection[postDataKey];
return false;
}

}
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Structural Dynamic Systems Computational Techniques and Optimization: Dynamic Analysis and Control Techniques Authors: Cornelius T. Leondes, Pages: 324, Published: 1999
Control and Dynamic Systems: Advances in Theory and Applications Authors: Cornelius T. Leondes, Pages: 371, Published: 1980
Dynamic Control of Quality in Production-inventory Systems: Coordination and Optimization Authors: David D. Yao, Shaohui Zheng, Pages: 218, Published: 2002
Dynamic Programming and Optimal Control Authors: Dimitri P. Bertsekas, Pages: 0, Published: 1995
Control and Dynamic Systems: Advances in Aerospace Systems Dynamics & Control Systems Authors: Cornelius T Leondes, Pages: 0, Published: 1990
Control and Dynamic Systems: Advances in Theory and Applications, Part 2 Authors: Cornelius T. Leondes, Pages: 318, Published: 1990
Control and Dynamic Systems: Advances in Theory and Applications Authors: Cornelius T. Leondes, Pages: 384, Published: 1978
Optimization Over Time: Dynamic Programming and Stochastic Control Authors: Peter Whittle, Pages: 0, Published: 1982
Control of Uncertain Dynamic Systems: A Collection of Papers Presented at the International Workshop on Robust Control, San Antonio, Texas, March 1991 Authors: Shankar P. Bhattacharyya, Lee H. Keel, Pages: 524, Published: 1991

Web:
Dynamic Control The most trusted name for ultimate sound and noise control. Acoustic solutions for car audio, hot rods and home theater. Dynamat is recognized by consumers ...
Dynamic Control : Home Specializes in manufacture and supply of off-the-shelf and custom tools for test engineers and technicians, with some focus on automotive testing and engine ...
Dynamic Control Systems Dynamic Control Systems provides custom controls for industry leaders nationwide .
MIT OpenCourseWare | Electrical Engineering and Computer Science ... 6.241 Dynamic Systems & Control. Fall 2003. Open loop feedback system. Open loop feedback system, with an input (r), output (y), and functions K(s) and P(s) ...
ASME : Dynamic Systems & Control Division - About DSCD Concentrates on control methods and devices, from servomechanisms and regulators to automatic controls, for dynamic systems involving forces, motion and/or ...
Journal of Dynamic Systems, Measurement, and Control Journal of Dynamic Systems, Measurement, and Control Cover. Editor:. Suhada Jayasuriya Texas A&M University. ISSN: 0022-0434. eISSN: 1528-9028 ...
2008 ASME DSCC Dynamic Systems and Control Conference DSCC-2008 Information for the 2008 Dynamic Systems and Control Conference.
Textbook: Dynamic Programming and Optimal Control The leading and most up-to-date textbook on the far-ranging algorithmic methododogy of Dynamic Programming, which can be used for optimal control, ...
Dynamic Layout Control Tutorial details:Written by: Jed Wood (usableFlash.com) Time: About 15 minutesDifficulty Level: IntermediateRequirements: Flash MXTopics Covered: Stage ...
Dynamic Animation and Control and Environment Import/Export of motion capture; Ragdoll simulation; Physical simulation of characters with dynamic control; Pose based dynamic control; Creation of videos ...

Videos:
ACT pt1: dynamic control of effects, instrument, and mixing SONAR 6's innovative new Active Controller Technology™ will forever change the way you work with instruments, effects, and mixing. Hosted by Cakewalk...
ACT pt2: Dynamic Control of Effects, Instruments, and Mixing SONAR 6's innovative new Active Controller Technology™ will forever change the way you work with instruments, effects, and mixing. Hosted by Cakewalk...
Dynamic Control Systems Dynamic Control Systems is Providing Services in the Los Angeles,CA area.
Dynamic Deeds Media: dynamic control image upload tutorial The is a tutorial that explains how to add an image to your Dynamic Control website. More info: http://dynamicdeeds.com
Low g Inertial Sensors for Vehicle Dynamic Control Low g inertial sensors for vehicle dynamic control on display at Freescale Technology Forum 2008.
Technical Briefing Number 6 - Third and Fourth Dynamic Hats the people who are in power on the planet believe that if they could control what you think, then you are totally under control. And in actual fact, ...
ONLINE DRUM TUTORIAL #3: DYNAMIC CONTROL ~ MASTERING THE TABLES OF TIME 04/08 McNally Smith College of Music Masterclass, focusing on musical phrasing with Dynamic Control Studies, from Ch. 1 of MASTERING THE TABLES OF TI...
Boston Dynamics: LittleDog The Legged Learning Robot LittleDog is a quadruped robot for research on learning locomotion. Scientists at leading institutions use LittleDog to pr...
dynamic control: image upload The is a tutorial that explains how to add an image to your Dynamic Control website. More info: http://dynamicdeeds.com
Dynamic Control of Nonholonomic Wheeled Mobile Robot(1) Dynamic Control of Nonholonomic Wheeled Mobile Robot




Search This Site:










compiler error message:cs1595: "mycontrols.report" is defined in multiple places

custom __dopostback()???

help!! i dont want frames in my site!

admin work with access

migrating from my sql server in my machine to my host sql server

why some page script become strange characters

scripting.dictionary in legacy asp

webpart, webcontrol, postback problem

security roles appear on "add" page

access to the path <path> is denied.

virtual path not found..

syntax errors

how to host a domain name

error: no data exists for the row/column.

help with new install of dnn 2.1.2

3.0.7 - minor typo mistake in default value on system resource file

form is not submitting

can someone please explain asp.net to me?

sql error

need help with dataset!

error creating portal from template

why doesn't the dropdownlist1.text have value in page_load function?

moving the wizard step links from left side

overload createrole() with custom roleprovider?

place a <div>-tag in the content place holder (or other sugestions)

mapping many addresses on a usa map

new registration notification?

declaring public connection string

update profile - this property cannot be set for anonymous users

export verb b2

 
All Times Are GMT