473,757 Members | 2,284 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
target)
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" %>

<!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>Untitl ed 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.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

{

[Bindable(true),

Category("Misc" ),

DefaultValue("F alse")]

string strApplySecurit y = null;

public string ApplySecurity

{
get

{

try

{

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

}

catch

{

}

if (strApplySecuri ty == null)

{

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

return "False";

}

else

{

return strApplySecurit y;

}

}

set

{

string strTestValue=nu ll;

try

{

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

}

catch { }

if (strTestValue == null)

{

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

}

else

{

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

}

}
}

}

}
Nov 19 '05 #1
0 1044

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

Similar topics

9
1760
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
4
2983
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...
0
1598
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...
6
2226
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...
6
3698
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,
2
1519
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
12
1715
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
6
11081
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...
8
3003
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.
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
Oralloy
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...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
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...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
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();...
0
5168
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...
1
3828
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
3
3395
muto222
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.