473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Custom Control Table member variable broke

I have been trying for 2 weeks to figure out how to
implement a table as a member variable that the user can
setup with the property designer with no luck. The code
below adds the table to the property designer, however it
will not write the HTML associated with the TABLE within
the custom server control tags unless you change the font
property within the table. For instance you can set the
ID of the table and its height and width then hit rebuild
and it all gets blown away because the table does'nt get
serialized.However set the ID,Width and Height again this
time change the Font property of the table to bold and it
magically writes the HTML code as shown in result 2,
which is exactly correct and what I want. Changing any
property value in the font of the table somehow triggers
VS to write the correct HTML..but changing any of the
table attributes doesnt do anything..you have to change
the font to get it to make any change...............

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing.Design;
using System.Web.UI.Design;

namespace RealGridII
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>

[ToolboxData("<{0}:RealGridControl runat=server></
{0}:RealGridControl>")]
public class RealGridControl :
System.Web.UI.WebControls.DataGrid
{
private Table m_myHeader;

/// <summary>
/// Constructor
/// </summary>
public RealGridControl()
{
m_myHeader = new Table();
}

[Category("LookHere"),NotifyParentProperty
(true),DesignerSerializationVisibility
(DesignerSerializationVisibility.Content),Persiste nceMode
(PersistenceMode.InnerProperty)]
public Table myDatagrid
{
get
{
return m_myHeader;
}
set
{
m_myHeader = value;
}
}

/// <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)
{
m_myHeader.RenderControl(output);
base.Render(output);

}
}
}

Result #1:
<form id="Form1" method="post" runat="server">
<cc1:realgridcontrol
id="RealGridControl2" style="Z-INDEX: 101; LEFT: 400px;
POSITION: absolute; TOP: 184px"
runat="server"
DataSource="<%# dataView1 %>" AutoGenerateColumns="False">

<Columns>
<asp:BoundColumn
DataField="EmployeeID" SortExpression="EmployeeID"
HeaderText="EmployeeID"></asp:BoundColumn>
<asp:BoundColumn
DataField="LastName" SortExpression="LastName"
HeaderText="LastName"></asp:BoundColumn>
<asp:BoundColumn
DataField="FirstName" SortExpression="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
</Columns>
</cc1:realgridcontrol></form>

Result #2
<form id="Form1" method="post" runat="server">
<cc1:realgridcontrol
id="RealGridControl2" style="Z-INDEX: 101; LEFT: 400px;
POSITION: absolute; TOP: 184px"
runat="server"
DataSource="<%# dataView1 %>" AutoGenerateColumns="False">
<myDatagrid Font-
Bold="True" ID="fuku"></myDatagrid>
<Columns>
<asp:BoundColumn
DataField="EmployeeID" SortExpression="EmployeeID"
HeaderText="EmployeeID"></asp:BoundColumn>
<asp:BoundColumn
DataField="LastName" SortExpression="LastName"
HeaderText="LastName"></asp:BoundColumn>
<asp:BoundColumn
DataField="FirstName" SortExpression="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
</Columns>
</cc1:realgridcontrol></form>
Nov 17 '05 #1
2 2549
Hi,

If you are looking for "UI type editor"[1] then I didn’t see that you
implement UI type editor class to the "table" property. You first need
to create your own class that derives from UITypeEditor. Then you need
to use the Editor attribute for that property [2].

I strongly recommand you to get a copy of :
Developing Microsoft ASP.NET Server Controls and Components
By Nikhil Kothari, Vandana Datje
[1] A class that is associated with a type or a property and provides a
specialized user interface for editing a property. A UI type editor is
launched from the property browser and is useful when the simple text
entry UI provided by the property browser is not adequate for editing a
property. For example, the color picker drop-down list within the
property grid that enables a page developer to select a color for the
BackColor or ForeColor property of a Web control in a WYSIWYG fashion is
a UI type editor. We'll show you how to implement UI type editors in the
"UI Type Editors" section in this chapter.

[2]
[Editor(typeof(MyStringEditor),
typeof(UITypeEditor))
]
public override Table Text {
get {
...;
}
set {
...;
}
}
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2


I have purchased this book last night and begun reading. However, the
Table UI editor is already built into VS and should be reusable.Every
sample in the book and online only uses a super custom class as an
example in which you have to go overide all these methods but this is
your standard table with no frills just like FontInfo,ImageEditor,URL
builder and Color. If your test this code it makes a beautiful table and
does everything it should do. VS automatically chooses the correct
Editor based on a table and its even reflected in the design view. But
the code isn't getting serialized when you change the table properties
only if you change the tables font property. I bought this book solely
to answer this question and the only thing close to this is writing a
property for every attribute of a table as shown in the example on page
220. Any help will be greatly appreciated....

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dennis | last post by:
I'm using VS 2003 my project uses COM interop and the Tao Framework. I have a custom control derived from UserControl. It implements many functions similar to the Tao's SimpleOpenGLControl, for...
0
by: jb_in_marietta | last post by:
All, I have written a very simple custom composite control that includes a control of type System.Web.UI.WebControls.Table. The control renders fine in run time, but for some reason, it does...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
3
by: | last post by:
Hi all, I have a question on reflection Lets say I have a custom object called Address. Now, lets say I have a string variable that holds the name of a variable in the object such as...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
6
by: Peter Hartlén | last post by:
Hi! What's the correct syntax for the default value design time attribute, using classdiagram view and Custom Attributes dialog. For a boolean: DefaultValue(true) DefaultValue("true")...
3
by: jaime | last post by:
Hi all. The source code download bundle for "Beginning C: From Novice to Professional, Fourth Edition" (ISBN: 1590597354) (Horton/Apress) contains a C source file (program9_09.c) which contains...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.