473,396 Members | 1,608 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,396 software developers and data experts.

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.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.Ge tValue(Object component)
System.Windows.Forms.PropertyGridInternal.Property DescriptorGridEntry.GetPropertyValueCore(Object
target)
System.Windows.Forms.PropertyGridInternal.Property DescriptorGridEntry.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;

}

}
}

}

}
Nov 19 '05 #1
0 1023

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

Similar topics

9
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. ...
4
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...
0
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...
6
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...
6
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...
2
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...
12
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...
6
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...
8
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.