473,836 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with a text box with custom properties in the IDE

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.Reflecti on.TargetInvoca tonException: Property accessor
'ApplySecurity' on object 'ATextBox2' threw the follwoing exception: Object
reference not set to an instance of an object~
System.NullRefe renceException
--inner stack trace--
System.Componen tModel.ReflectP ropertyDescript or.GetValue(Obj ect component)
System.Windows. Forms.PropertyG ridInternal.Pro pertyDescriptor GridEntry.GetPr opertyValueCore (Object
System.Windows. Forms.PropertyG ridInternal.Pro pertyDescriptor GridEntry.get_P ropertyValue()

*************** *************** ****
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="AEPFi eldDisco.aspx.c s" Inherits="AEPSa mpleWPD" %>

<%@ Register Assembly="AWebC ontrolLibrary" Namespace="AEPo rtal"
TagPrefix="cc1" %>


<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitl ed Page</title>



<form id="form1" runat="server">

<cc1:ATextBox ID="ATextBox1" runat="server"
ApplySecurity=" True"></cc1:ATextBox>




*************** *************** ***************

My text box in the dll has this code

using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Componen tModel;

using System.Drawing;

namespace AEPortal


[ToolboxData("<{ 0}:ATextBox runat=server
ApplySecurity=T rue></{0}:ATextBox>")]

public class ATextBox : System.Web.UI.W ebControls.Text Box



Category("Misc" ),

DefaultValue("F alse")]

string strApplySecurit y = null;

public string ApplySecurity





strApplySecurit y = this.Attributes["ApplySecur ity"].ToString();





if (strApplySecuri ty == null)


this.Attributes .Add("ApplySecu rity", "False");

return "False";




return strApplySecurit y;





string strTestValue=nu ll;



strTestValue = this.Attributes["ApplySecur ity"].ToString();


catch { }

if (strTestValue == null)


this.Attributes .Add("ApplySecu rity", value);




this.Attributes["ApplySecur ity"] = value;




Nov 19 '05 #1
0 1045

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

Similar topics

by: Marina | last post by:
Here is the problem. If 2 different properties on the same (or different) control are bound to the same data column, changing the Text property and calling EndCurrentEdit discards the new value. Changing a custom property and calling EndCurrentEdit accepts the new value, stores it in the datasoure and behaves normally. Here is a reproduceable example: First, extend Textbox: Public Class MyTextBox Inherits TextBox
by: waltborders | last post by:
Hi, Because the blind are unable to use a mouse, keyboard navigation is key. A major difficulty is that not all windows forms controls are keyboard 'tab-able' or 'arrow-able' or have "tab order". The application is built and the next step is to create the custom JAWS (Freedom Scientific)screen reader script to read the application. The application uses the accessibility properties for controls provided by C#. JAWS reads properties...
by: Lucas, Todd | last post by:
Hello everyone! I'm having a problem with a WebControl that I'm designing for a Menu. I've been at it for about 3 weeks now, and can't seem to get around this problem. So I'm hoping that someone can help me ... My environment: VS 2003 v7.1.3088, Win2K v5.0.2195 SP3, IE6 v6.0.2800.1106 browser. I have a class (C3Menu) derived from WebControl, with a property (MenuItems) that is a collection of menu items. The collection property is...
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base class would have CurrentUser property that would hold customer class in session and that was fine for all my situations. Now ASP.NET 2.0 came and we have Profile property for pages that could be extended with configuration to have custom...
by: Kevin Chambers | last post by:
Hi all-- In an attempt to commit an Access MDB to a versioning system (subversion), I'm trying to figure out how to convert a jet table's metadata to text, a la SaveAsText. The end goal is to be able to build an MDB completely from the svn repository text files. Has anybody dealt with this? Thanks in advance,
by: shapper | last post by:
Hello, I have a contact form in my web site which is working just fine on my computer! When I uploaded my web site to my hosting server I get an error when I SUBMIT my form, i.e., when I click submit to send the email: Security Exception Description: The application attempted to perform an operation not
by: Ron M. Newman | last post by:
Hi, I can load an assembly using the Assembly.Load(....) However, I'd like dynamic loading of assemblies to be identical to putting an assembly reference in your VS2005 project. and yes, I know about the unloading problems. Let's say I don't care for the moment. If I have an assemlbly file at "c:\\assembly.dll" - how do I load it at runtime as if it were references in the project at build time? I know
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
by: alexcsharp2 | last post by:
Hello. I created a designer in c#. Everything is working excepted the property grid. I want to show only the properties I added. So I created a class which inherits of a button. And I added properties. But I want to filter the base properties. So to do this, I inherit my class from ICustomTypeDescriptor.
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.