Andrew Stevenson's WebLog

Write Here Write Now

Syndication

.Net Languages

ADO.Net

Asp.Net (Misc.)

Asp.Net Controls

Bad Patterns

Err What?

Files and Folders

Forums

IE Add-Ins

Methods for the Madness

Performance

See Clearer, C#

Test Driven

June 2004 - Posts

IExtenderProvider & Asp.Net

I've implemented a simple extender following the example here.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcomponentmodelprovidepropertyattributeclasstopic.asp

I've used a string property instead of the CultureInfo from the example. When I change the value on the design surface, the SetXX method is called with the correct control, but when I look at the code that is serialized into InitializeComponent it uses "this" which is the page, rather than "this.Label1".

I am wondering if there is a better example of an extender with WebControls, if I am doing something silly, if it would work if I were at work and using VS 2003 instead of  being at home with VS 2002, how many people are gonna blast me for posting this here instead of in some newsgroup where 12 people will aske me if this has answered my question ;)

this.webControlExtender1.SetLocalizationKey(this, "dfsdfsd");
 
using
System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using System.ComponentModel;

[ProvideProperty("MyProperty",
typeof(Control))]
[ProvideProperty("LocalizationKey",
typeof(Control))]
public class WebControlExtender :Control, IExtenderProvider
{
public WebControlExtender()
{

}
public bool CanExtend(object target)
{

return (target is Control);
}
private string _testString ="";
public string GetLocalizationKey(Control control)
{
return _testString;
}
public void SetLocalizationKey(Control control,string value)
{
System.Windows.Forms.MessageBox.Show(control.ID);
_testString =
value;
}
}

Update:
I'm saving to the html attributes for now.
I would really like to save property values I add to a WebControl into the resx the same way that properties I add to a component are saved.

public void SetQuestionID(WebControl control,string value)

{

if(value.Length >0 )
{
control.Attributes[AttributeQuestionID] =
value;
}
else
{
control.Attributes.Remove(AttributeQuestionID);
}
ComponentChanging(control);

}

Posted Friday, June 25, 2004 12:26 PM by AndrewSeven | 2 comment(s)

Filed under:

The G(mail) Spot - On/In/ I've got mail/ Thanks Frank!

Me too me too.

Please :D

Tiernan O'toole might have an invite for me http://blog.lotas-smartman.net/

http://weblogs.asp.net/tiernanotoole/archive/2004/06/21/161272.aspx

Not long after posting, I got a offer of an invitation from Frank Levigne ( http://www.franksworld.com/ )

The “thank you” deserves a post of it own, but I wouldn't want annother comment from matthew.

Thanks again FRank

This page is #2 on google for g mail with a space... just after gmail.

Posted Monday, June 21, 2004 9:24 AM by AndrewSeven | 3 comment(s)

Adding Design-Time Support to ASP.NET Controls (by G. Andrew Duthie)

I keep having to search for this so I am adding it here

Adding Design-Time Support to ASP.NET Controls

G. Andrew Duthie

http://msdn.microsoft.com/library/en-us/dnaspp/html/ASPNet-AddDesignTimeSupport.asp

 

 

 

Posted Thursday, June 03, 2004 9:39 AM by AndrewSeven | 1 comment(s)

Filed under:

More Posts