Can I stop this behavior
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolscs' list.


Scott Watermasysk

I have a custom control that inherits from the datagrid. As part of my
control, I add an EditCommandColumn in my controls Init event (I also set a
bunch of default properties in my controls constructor).

If I just leave all of the default properties alone, everything works fine.

Here is what the code looks like: <TAN:TABLEEDITOR id="myte" PageSize = "7"
MaxStringLength = "100" runat="server"/>

However, if I change any property with property viewer, my EditCommandColumn
(and other items) now appear in the design viewer. (see below).

Is it possible to turn this behavior off?

Thanks,
Scott

Here is what happens:
________________________________________________________________________
<TAN:TABLEEDITOR id="myte" PageSize = "7" MaxStringLength = "100"
runat="server">
<AlternatingItemStyle BackColor="#F2F2F2">
</AlternatingItemStyle>

<ItemStyle BackColor="White">
</ItemStyle>

<HeaderStyle Font-Bold="True" BorderWidth="0px" ForeColor="White"
BorderColor="Blue" BackColor="Blue">
</HeaderStyle>

<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>

<PagerStyle Mode="NumericPages">
</PagerStyle></TAN:TABLEEDITOR>

________________________________________
Scott Watermasysk
Click here to reveal e-mail address
ASP.Net information you can really REUSE!
http://TripleASP.Net
Coming Soon:
NJ DotNet Users Group http://NJDNUG.org

Reply to this message...
 
    
Scott Watermasysk

FYI,

I was able to stop this behavior by adding:

if (HttpContext.Current != null)
{
    //Add my EditButtonCommands
    //ItemStyle's
{

But I am hoping there is a cleaner way to do this.

Thanks,
Scott
________________________________________
Scott Watermasysk
Click here to reveal e-mail address
ASP.Net information you can really REUSE!
http://TripleASP.Net
Coming Soon:
NJ DotNet Users Group http://NJDNUG.org

-----Original Message-----
From: Scott Watermasysk [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 02, 2002 11:25 PM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Can I stop this behavior

I have a custom control that inherits from the datagrid. As part of my
control, I add an EditCommandColumn in my controls Init event (I also set a
bunch of default properties in my controls constructor).

If I just leave all of the default properties alone, everything works fine.

Here is what the code looks like: <TAN:TABLEEDITOR id="myte" PageSize = "7"
MaxStringLength = "100" runat="server"/>

However, if I change any property with property viewer, my EditCommandColumn
(and other items) now appear in the design viewer. (see below).

Is it possible to turn this behavior off?

Thanks,
Scott

Here is what happens:
________________________________________________________________________
<TAN:TABLEEDITOR id="myte" PageSize = "7" MaxStringLength = "100"
runat="server">
<AlternatingItemStyle BackColor="#F2F2F2">
</AlternatingItemStyle>

<ItemStyle BackColor="White">
</ItemStyle>

<HeaderStyle Font-Bold="True" BorderWidth="0px" ForeColor="White"
BorderColor="Blue" BackColor="Blue">
</HeaderStyle>

<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>

<PagerStyle Mode="NumericPages">
</PagerStyle></TAN:TABLEEDITOR>

________________________________________
Scott Watermasysk
Click here to reveal e-mail address
ASP.Net information you can really REUSE!
http://TripleASP.Net
Coming Soon:
NJ DotNet Users Group http://NJDNUG.org

| [aspngcontrolscs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
TIM ELLISON
Scott,

When you're building a custom control, both design-time and runtime need to
be taken into consideration. You may want to take a look at custom
designers and design-time attributes. What you did will work just fine, but
it does muddy up the code as you stated.

Look specifically at the ControlDesigner class and ControlBuilder class.

What you'll need to do is derive from ControlDesigner and override
GetDesignTimeHtml() method and GetRenderHtml().

What that does for you is keeps your Render() method clean and concentrated
solely on runtime.

Chapter 9 of Wrox's "Professional ASP.NET Server Controls" dives in depth
into what you're trying to do.

Regards,

Tim Ellison
Senior Web Applications Developer,
Long and Foster Real Estate
703-359-1884
Click here to reveal e-mail address

-----Original Message-----
From: Scott Watermasysk [mailto:Click here to reveal e-mail address]
Sent: Friday, May 03, 2002 12:24 AM
To: aspngcontrolscs
Subject: [aspngcontrolscs] RE: Can I stop this behavior

FYI,

I was able to stop this behavior by adding:

if (HttpContext.Current != null)
{
    //Add my EditButtonCommands
    //ItemStyle's
{

But I am hoping there is a cleaner way to do this.

Thanks,
Scott
________________________________________
Scott Watermasysk
Click here to reveal e-mail address
ASP.Net information you can really REUSE!
http://TripleASP.Net
Coming Soon:
NJ DotNet Users Group http://NJDNUG.org

-----Original Message-----
From: Scott Watermasysk [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 02, 2002 11:25 PM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Can I stop this behavior

I have a custom control that inherits from the datagrid. As part of my
control, I add an EditCommandColumn in my controls Init event (I also set a
bunch of default properties in my controls constructor).

If I just leave all of the default properties alone, everything works fine.

Here is what the code looks like: <TAN:TABLEEDITOR id="myte" PageSize = "7"
MaxStringLength = "100" runat="server"/>

However, if I change any property with property viewer, my EditCommandColumn
(and other items) now appear in the design viewer. (see below).

Is it possible to turn this behavior off?

Thanks,
Scott

Here is what happens:
________________________________________________________________________
<TAN:TABLEEDITOR id="myte" PageSize = "7" MaxStringLength = "100"
runat="server">
<AlternatingItemStyle BackColor="#F2F2F2">
</AlternatingItemStyle>

<ItemStyle BackColor="White">
</ItemStyle>

<HeaderStyle Font-Bold="True" BorderWidth="0px" ForeColor="White"
BorderColor="Blue" BackColor="Blue">
</HeaderStyle>

<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>

<PagerStyle Mode="NumericPages">
</PagerStyle></TAN:TABLEEDITOR>

________________________________________
Scott Watermasysk
Click here to reveal e-mail address
ASP.Net information you can really REUSE!
http://TripleASP.Net
Coming Soon:
NJ DotNet Users Group http://NJDNUG.org

| [aspngcontrolscs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngcontrolscs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.Web.HttpContext
System.Web.UI.ControlBuilder
System.Web.UI.Design.ControlDesigner
System.Web.UI.MobileControls.PagerStyle
System.Web.UI.WebControls.ButtonColumn
System.Web.UI.WebControls.EditCommandColumn
System.Web.UI.WebControls.LinkButton
System.Windows.Forms.Design.ControlDesigner




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com