RE POSTING Problem with a text box with custom properties in the IDE !!!HELP any MVP!!

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"Sanjay Pais" <sanjay@xxxxxxxxxx> wrote in message
news:%231FYCIFmFHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
> This is an extension of an earlier post
> I have created a custom text box and compiled it and dropped it into my
> toolbox. However when I change the value of my custom property in design
> mode and switch between design mode to page source and back to design mode
> i
> am unable to retrieve the property value I set. Also the property setting
> in
> the html page is lost.
>
> Thsi is the error I get
> **********************************
> System.Reflection.TargetInvocatonException: Property accessor
> 'ApplySecurity' on object 'ATextBox2' threw the follwoing exception:
> Object
> reference not set to an instance of an object~
> System.NullReferenceException
> --inner stack trace--
> System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
> System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.GetPropertyValueCore(Object
> target)
> System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.get_PropertyValue()
>
> **********************************
> Mu source code is
> I have added a custom property called ApplySecurity to the html
>
> my custom text box in the page html source of the designer looks like this
> <%@ Page Language="C#" AutoEventWireup="true"
> CodeFile="AEPFieldDisco.aspx.cs" Inherits="AEPSampleWPD" %>
>
> <%@ Register Assembly="AWebControlLibrary" Namespace="AEPortal"
> TagPrefix="cc1" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
>
> <html xmlns="http://www.w3.org/1999/xhtml"; >
>
> <head runat="server">
>
> <title>Untitled Page</title>
>
> </head>
>
> <body>
>
> <form id="form1" runat="server">
>
> <cc1:ATextBox ID="ATextBox1" runat="server"
> ApplySecurity="True"></cc1:ATextBox>
>
> </form>
>
> </body>
>
> </html>
>
> *********************************************
>
> My text box in the dll has this code
>
> using System;
>
> using System.Collections.Generic;
>
> using System.Text;
>
> using System.Web.UI;
>
> using System.Web.UI.WebControls;
>
> using System.ComponentModel;
>
> using System.Drawing;
>
> namespace AEPortal
>
> {
>
> [ToolboxData("<{0}:ATextBox runat=server
> ApplySecurity=True></{0}:ATextBox>")]
>
> public class ATextBox : System.Web.UI.WebControls.TextBox
>
> {
>
> [Bindable(true),
>
> Category("Misc"),
>
> DefaultValue("False")]
>
> string strApplySecurity = null;
>
> public string ApplySecurity
>
> {
>
>
> get
>
> {
>
> try
>
> {
>
> strApplySecurity = this.Attributes["ApplySecurity"].ToString();
>
> }
>
> catch
>
> {
>
> }
>
> if (strApplySecurity == null)
>
> {
>
> this.Attributes.Add("ApplySecurity", "False");
>
> return "False";
>
> }
>
> else
>
> {
>
> return strApplySecurity;
>
> }
>
> }
>
> set
>
> {
>
> string strTestValue=null;
>
> try
>
> {
>
> strTestValue = this.Attributes["ApplySecurity"].ToString();
>
> }
>
> catch { }
>
> if (strTestValue == null)
>
> {
>
> this.Attributes.Add("ApplySecurity", value);
>
> }
>
> else
>
> {
>
> this.Attributes["ApplySecurity"] = value;
>
> }
>
> }
>
>
> }
>
> }
>
> }
>
>


.



Relevant Pages

  • Problem with a text box with custom properties in the IDE
    ... I have created a custom text box and compiled it and dropped it into my ... mode and switch between design mode to page source and back to design mode i ... I have added a custom property called ApplySecurity to the html ...
    (microsoft.public.dotnet.framework.aspnet)
  • Property Group issues
    ... I have created a composite custom control. ... It works fine, renders, all is good on that side. ... I am trying to cleaup the design mode side of it, and in turn clean up the ... If I change a a property that is part of a custom grouping (That I ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Modifying custom menu in Access 2007
    ... I have an Access 2000 application that uses a custom menu bar and runs with ... How do I modify this custom menu in Access 2007? ... how do I set up the design mode in Access 2007 which ...
    (microsoft.public.access.modulesdaovba)
  • Re: How to create a button to switch to a custom view
    ... design mode and enter this in the sub: ... put in the name of your Custom View in ??? ... Bearacade's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35016 ...
    (microsoft.public.excel.programming)
  • Re: StreamReader ReadLine alternate End Of Line
    ... StreamReader is not customizable for EOL. ... You can create a custom ... the characters of the string up to the first X'0D'. ...
    (microsoft.public.dotnet.languages.csharp)